您可以提供的任何帮助将不胜感激。
我有一个应用程序,它有一个 tableView、detailView、flipView 和 moreDetail View。在过渡到第 26 个元素之前移动很好。当我点击导航到翻转和 moreDetailView 的按钮时,应用程序崩溃。
我收到错误消息:[NSIndexPath row] message sent to deallocated instance
。
我想我可能调用 indexPath 的次数太多了,但是为什么在第 25 个元素之前一切正常,然后停止工作?NSIndexPath 是如何被释放的?我从来没有释放它。
如果你知道,请帮忙。谢谢!!!
Xcode 说问题出在这里:
@implementation produceView aka *detailView*
- (IBAction)showInfo {
FlippedProduceView *fView = [[FlippedProduceView alloc]initWithIndexPath:index];
fView.flipDelegate = self;
fView.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:fView animated:YES];
[fView release];
}
- (IBAction) buttonPushed:(id)sender
{
picView *pictureView = [[picView alloc]initWithIndexPath:index];
pictureView.picDelegate = self;
pictureView.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:pictureView animated:YES];
[pictureView release];
}
-(id)initWithIndexPath:(NSIndexPath *)myIndexPath {
if (self == [super init]) {
path = myIndexPath;
}
return self;
}
@implementation picView aka *moreDetailView*
- (void)viewDidLoad {
RipeGuideAppDelegate *AppDelegate = (RipeGuideAppDelegate *)[[UIApplication sharedApplication] delegate];
self.picViewArray = AppDelegate.arrayProduceInfo;
NSMutableDictionary *dictionary = [picViewArray objectAtIndex:path.row];
}
@implementation FlippedProduceView aka *flipView*
- (id)initWithIndexPath:(NSIndexPath *)myIndexPath {
if (self == [super init]) {
indexes = myIndexPath;
}
return self;
}
- (void)viewDidLoad {
RipeGuideAppDelegate *AppDelegate = (RipeGuideAppDelegate *)[[UIApplication sharedApplication] delegate];
self.flipViewArray = AppDelegate.arrayProduceInfo;
NSMutableDictionary *dictionary = [flipViewArray objectAtIndex:indexes.row];
}