嗨,我的应用程序崩溃,我无法弄明白。我相信它与动画有关。我不知道崩溃发生在哪里,所以我已经包含了我认为发生的地方,还有一些动画发生的方法。
在UICollectionViewFlowLayout子类中:
#define kTransformScale CATransform3DMakeScale(.8, .8, 1)
#define kTransformAngle M_PI
- (UICollectionViewLayoutAttributes *)initialLayoutAttributesForAppearingItemAtIndexPath:(NSIndexPath *)itemIndexPath
{
UICollectionViewLayoutAttributes *attributes = [super initialLayoutAttributesForAppearingItemAtIndexPath:itemIndexPath];
if ([self.insertIndexPaths containsObject:itemIndexPath])
{
// only change attributes on inserted cells
if (!attributes)
{
attributes = [self layoutAttributesForItemAtIndexPath:itemIndexPath];
}
attributes.alpha = 0.0;
if([_coordinator isCorporateTile:itemIndexPath.item])
{
attributes.transform3D = CATransform3DMakeTranslation([self collectionViewContentSize].width, 0, 0);
}
else
{
attributes.transform3D = CATransform3DRotate(kTransformScale, kTransformAngle, 0, 1, 0);
}
}
return attributes;
}
+ (CABasicAnimation *)animationFromTransformation:(CATransform3D)fromTransformation
toTransformation:(CATransform3D)toTransformation
timingFunction:(CAMediaTimingFunction *)timingFunction
duration:(NSTimeInterval)duration
{
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform"];
animation.fromValue = [NSValue valueWithCATransform3D:fromTransformation];
animation.toValue = [NSValue valueWithCATransform3D:toTransformation];
animation.timingFunction = timingFunction;
animation.duration = duration;
return animation;
}
- (void)animateToTransform:(CATransform3D)toTransform
timingFunction:(CAMediaTimingFunction *)timingFunction
duration:(NSTimeInterval)duration
alterModel:(BOOL)alterModel
{
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform"];
animation.fromValue = [NSValue valueWithCATransform3D:[(CALayer *)[self presentationLayer] transform]];
animation.toValue = [NSValue valueWithCATransform3D:toTransform];
animation.timingFunction = timingFunction;
animation.duration = duration;
if (alterModel)
{
self.transform = toTransform;
}
[self addAnimation:animation forKey:@"transform"];
}
2334 | 01:19:46:727 |$ ERROR: Uncaught Exception: -[NSConcreteValue doubleValue]: unrecognized selector sent to instance 0x1807fce0
2335 | *01:19:46:727 |(
2336 | 00:00:00:000 | CoreFoundation 0x2e343e9b <redacted> + 154
2337 | 00:00:00:001 | libobjc.A.dylib 0x389ed6c7 objc_exception_throw + 38
2338 | 00:00:00:002 | CoreFoundation 0x2e3477b7 <redacted> + 202
2339 | 00:00:00:003 | CoreFoundation 0x2e3460af <redacted> + 706
2340 | 00:00:00:004 | CoreFoundation 0x2e294dc8 _CF_forwarding_prep_0 + 24
2341 | 00:00:00:005 | QuartzCore 0x30833ae5 <redacted> + 40
2342 | 00:00:00:006 | UIKit 0x30ced03b <redacted> + 226
2343 | 00:00:00:007 | UIKit 0x30cececb <redacted> + 14
2344 | 00:00:00:008 | CoreFoundation 0x2e28c803 <redacted> + 50
2345 | 00:00:00:009 | CoreFoundation 0x2e28621d <redacted> + 220
2346 | 00:00:00:010 | UIKit 0x30af731f <redacted> + 526
2347 | 00:00:00:011 | UIKit 0x30accd79 <redacted> + 196
2348 | 00:00:00:012 | UIKit 0x30acb569 <redacted> + 7116
2349 | 00:00:00:013 | CoreFoundation 0x2e30ef1f <redacted> + 14
2350 | 00:00:00:014 | CoreFoundation 0x2e30e3e7 <redacted> + 206
2351 | 00:00:00:015 | CoreFoundation 0x2e30cbd7 <redacted> + 630
2352 | 00:00:00:016 | CoreFoundation 0x2e277471 CFRunLoopRunSpecific + 524
2353 | 00:00:00:017 | CoreFoundation 0x2e277253 CFRunLoopRunInMode + 106
2354 | 00:00:00:018 | GraphicsServices 0x32f7e2eb GSEventRunModal + 138
2355 | 00:00:00:019 | UIKit 0x30b2c845 UIApplicationMain + 1136
2356 | 00:00:00:020 | nukonize.dylib 0x0052df0f nukona_UIApplicationMain + 358
2357 | 00:00:00:021 | BrokerPresent 0x00086c2b main + 70
2358 | 00:00:00:022 | libdyld.dylib 0x38ee6ab7 <redacted> + 2
2359 | *00:00:00:022 |)