Tag: 客观

我可以知道在viewWillAppear它被称为导航控制器popup后(后退button)?

假设我有UIViewController A和B.用户通过push segue从A导航到B. 比用户按下后退button来到A. 现在viewWillAppear的A被调用。 我可以知道在这里的代码,我来自后退button( navigationController popTo… )而不是另一种方式? 而且不用在B视图控制器中编写特殊的代码。

可resize的圆形UIView

我正在寻找一种方法来创build一个可resize并保持居中的CIRIVULAR UIView ( 见图 )。 这个例子中的CIRCULAR视图是一个UIView子类WCSDailyGoal 。 ContainerView.m – (void)createDailyGoalView { _dailyGoalView = [[WCSDailyGoalView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)]; _dailyGoalView.delegate = self; _dailyGoalView.goal = 200; _dailyGoalView.center = self.view.center; [self.view addSubview:_dailyGoalView]; } WCSDailyGoal.m – (void)setGoal:(CGFloat)goal { CGPoint saveCenter = self.center; CGRect newFrame = CGRectMake(self.frame.origin.x, self.frame.origin.y, goal, goal); self.frame = newFrame; self.layer.cornerRadius = goal / 2.0; self.center […]

被纵向/横向模式照片的UIImageOrientation困惑

我使用ios的系统相机拍摄两张照片,一张是纵向模式,另一张是横向模式,然后使用imagePicker在我的应用中挑选出来: -(void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{ UIImage* sourceImage = [info objectForKey:UIImagePickerControllerOriginalImage]; UIImageOrientation imageOrientation = sourceImage.imageOrientation; NSLog(@"%d",imageOrientation); } 请注意,我注销了我刚刚挑出的图像的UIImageOrientation值。 结果是肖像模式照片的值是3 (它代表UIImageOrientationRight)和风景模式照片是0 (UIImageOrientationUp)我只是不明白为什么。 谁能解释一下吗? 谢谢!

AUGraph和stream媒体audio(http和ets)

我有基于AUGraph的球员(我需要均衡器)。 播放器可以播放本地audio文件。 现在我想添加支持streamaudio。 我可以用它来做什么? 任何像AVAssetReader(AVAssertReader不能播放stream:(),也许任何人都知道它打开库的标准类吗?谢谢。

符号化iOS崩溃地址返回不合适的结果

最近我花了几天的时间来学习如何用自定义解决scheme来收集崩溃的行号。 我知道我需要.app和.dSYM文件,我已经检查了UUID,它和我得到的崩溃一样,我也得到了UUID来validation。 三个相同的UUID和架构是arm64,我得到崩溃从我的iPhone5Stesting它。 好的,比方说,我在我的堆栈跟踪中有两个与我的应用程序相关。 这是从我得到的JSON完整的stacktrace。 "0 MyTestApp 0x10000efe8 0x100008000 + 28648", "1 UIKit 0x1863d90c8 0x186390000 + 299208", "2 UIKit 0x1863d905c 0x186390000 + 299100", "3 UIKit 0x1863c2538 0x186390000 + 206136", "4 UIKit 0x1863d8a5c 0x186390000 + 297564", "5 UIKit 0x1863d86f0 0x186390000 + 296688", "6 UIKit 0x1863d3388 0x186390000 + 275336", "7 UIKit 0x1863a4b68 0x186390000 + 84840", "8 UIKit […]

Sprite Kit碰撞多次碰撞

我已经看过,并已经find了单个碰撞的答案,但我正在寻找一种方法来检测多种types的碰撞。 我正在做一个有3次碰撞的游戏。 用户飞机与敌方子弹相撞,用户的子弹与敌机(我已经工作过)发生碰撞,敌方子弹与用户子弹相撞。 我有所有的categoryBitMask和contactTestBitMask设置和更正。 这是我的委托方法。 – (void) didBeginContact:(SKPhysicsContact *)contact { SKPhysicsBody *firstBody, *secondBody; if (contact.bodyA.categoryBitMask < contact.bodyB.categoryBitMask) { firstBody = contact.bodyA; secondBody = contact.bodyB; } else { firstBody = contact.bodyB; secondBody = contact.bodyA; } // if user plane hits enemy bullet if ((firstBody.categoryBitMask == playerShipCategory) && (secondBody.categoryBitMask == enemyBulletCategory)) { [self takeDamageByAmount:POINT_INCREMENTER]; [_enemyBullet removeFromParent]; SKAction […]

使用UIImageView图层的边框宽度的颜色填充进度

我有UIImageView,我已经使它成为一个宽度层的圆圈,就像在这个图像: 用户可以更新图片并上传新图片,图片上传时我有一个进度callback。 我想要的是在图像上传时用颜色animation边框,例如当用户点击上传边框从绿色开始,根据进度填充宽度。 我试着用这个代码: CAShapeLayer *circle = [CAShapeLayer layer]; circle.path = [UIBezierPath bezierPathWithArcCenter:CGPointZero radius:27 startAngle:-M_PI_2 endAngle:2 * M_PI – M_PI_2 clockwise:YES].CGPath; circle.fillColor = [UIColor clearColor].CGColor; circle.strokeColor = [UIColor greenColor].CGColor; circle.lineWidth = 4; CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"]; animation.duration = 10; animation.removedOnCompletion = NO; animation.fromValue = @(0); animation.toValue = @(1); animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; [circle addAnimation:animation […]

将文本作为string共享到其他应用程序

我有一个string,基本上看起来像这样: 成绩: 球员一:得分 球员二分数 球员三:得分 我想分享这个文本到WhatsApp,Facebook,iMessage等应用程序。这样做的最好方法是什么? 我曾尝试以.txt文件forms共享,但在WhatsApp中将其作为文件共享,而不是常规消息。

UItableViewCells中的单选button逻辑

嘿,我正在一个屏幕上,用户有选项组例如“饮料”,这是我的tableView部分的标题,他们的select是“7up”,“可乐”等我的表的单元格。 现在每个选项组选项(按单词顺序排列的每个单元格)都有一个单选button。 我想要实现这个。 我遇到问题,如果用户select任何单元格的单选button,然后应该取消select其他单选button,但如何? 请任何帮助

崩溃在集合视图的performBatchUpdates

我有一个集合视图显示两个不同的图像数量的数组这将是一个collectionview视图的两个不同的视图之间切换 – (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { if (self.storyview) { return 4; } else { return 1; } } 我在哪里执行收集视图的批量更新。 它正在坠毁,因为我有两个段数 [self.collectionView performBatchUpdates:^{ NSRange range = NSMakeRange(0, [self.collectionView numberOfSections]); NSIndexSet *indexSet = [NSIndexSet indexSetWithIndexesInRange:range]; [self.collectionView deleteSections:indexSet]; [self.collectionView insertSections:indexSet]; } completion:^(BOOL finished) { [self.collectionView reloadData]; }]; 我的崩溃日志如下: Assertion failure in -[UICollectionView _endItemAnimations], /SourceCache/UIKit_Sim/UIKit-3318.16.14/UICollectionView.m:3901 Terminating app due to uncaught […]