这是我为 iOS 7 更新应用程序以来一直遇到的一个新问题。每次在设备或模拟器上启动应用程序时,我都会收到此错误代码
RecipeDetailViewController scrollViewDidScroll:]: 消息发送到释放的实例 0x15746c40 并且它崩溃了。
我启用了 NSZombie,这就是它给我的代码。在它给出 exc_bad_access 代码之前。
这是我的 ScrollViewDidSCroll 代码
- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
// Depending on how far the user scrolled, set the new offset.
// Divide by a hundred so we have a sane value. You could adjust this
// for different effects.
// The larger you number divide by, the slower the shadow will change
float shadowOffset = (scrollView.contentOffset.y/1);
// Make sure that the offset doesn't exceed 3 or drop below 0.5
shadowOffset = MIN(MAX(shadowOffset, 0), 0.6);
//Ensure that the shadow radius is between 1 and 3
float shadowRadius = MIN(MAX(shadowOffset, 0), 0.6);
//apply the offset and radius
self.navigationController.navigationBar.layer.shadowOffset = CGSizeMake(0, shadowOffset);
self.navigationController.navigationBar.layer.shadowRadius = shadowRadius;
self.navigationController.navigationBar.layer.shadowColor = [UIColor blackColor].CGColor;
self.navigationController.navigationBar.layer.shadowOpacity = 0.2;
}