1

这一直让我发疯 - 我有一个带有 @property picTable 的 ParentViewController 类(没有 xib),然后是带有 xib 的 ChildViewController(ParentViewController 的子类)和 File's Owner 的 picTable 部分链接起来。

我注意到了这个问题,因为我需要从 URLRequest 添加更多数据 - 我在 NSArray 中有数据,但调用 reloadData 什么也没做 - 断点显示 self.picTable 为空 - 但它肯定是链接的(通过断点)在视图生命周期的早期。

我尝试使用 NSNotificationCenter、调度队列和 [self performSelectorOnMainThread... 都无济于事 - 我的 refreshTableView 总是被调用,但断点显示表视图为空。

试过 -

@property (nonatomic, strong) IBOutlet UITableView *picTable;

和 -

@property(非原子,保留)IBOutlet UITableView *picTable;

两个类的链接:

家长: https ://github.com/gileze33/Ticklr/blob/master/Ticklr/GWTPicPresentingViewController.h https://github.com/gileze33/Ticklr/blob/master/Ticklr/GWTPicPresentingViewController.m

子类: https ://github.com/gileze33/Ticklr/blob/master/Ticklr/GWTPicViewController.h https://github.com/gileze33/Ticklr/blob/master/Ticklr/GWTPicViewController.m

4

1 回答 1

0

即使您从子类调用 [super initWithNibNamed...],我仍然怀疑 nib 是否将 tableview 连接到超类。即使在超类中定义 tableView 属性对您的设计很重要,也请尝试将 tableView 属性向下移动到子类,然后查看它是否有效。

于 2013-04-14T04:40:05.777 回答