tableView属性导致循环

时间:2013-01-18 17:37:33

标签: iphone objective-c cocoa crash

我有一个UITableViewController的子类,当我在viewDidLoad中调用self.tableView时,它会崩溃并继续调用相同的方法。我已经将它从使用故事板(工作正常)转移到代码,现在它出现了这个bug。我有一个带有UITableViewCell子类的xib文件。

- (void)viewDidLoad
{
[super viewDidLoad];

UINib *nib = [UINib nibWithNibName:@"AddCell" bundle:nil];

//here
    [self.tableView registerNib:nib forCellReuseIdentifier:@"AddCell"];

self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancel:)];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(done:)];

// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;

// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
}

想知道是否有人有同样的问题或是否有解决方案。

提前致谢

1 个答案:

答案 0 :(得分:0)

几乎看起来包含上述-viewDidLoad实现的类已经拥有了nib。这意味着每次醒来,它都会自行唤醒......

......然后唤醒自己,然后自我唤醒,然后自我唤醒,然后自我唤醒,然后唤醒自己,然后唤醒自己,然后唤醒自己,然后唤醒自己,然后唤醒自己然后它会自我唤醒,然后自我唤醒,然后自我唤醒,然后自我醒来,然后自我唤醒,然后自我唤醒,然后自我醒来,然后自醒,...... ...... ......

这可能是你的问题吗?

相关问题