我有一个类定义如下:
@interface ClassViewController : ContentViewController <UITableViewDelegate,
UITableViewDataSource> {
IBOutlet UITableView* mTableView;
NSMutableArray *feeds;
NSMutableData *responseData;
}
@property (nonatomic, retain) UITableView* mTableView;
@property (nonatomic, strong) NSMutableArray* feeds;
@property (nonatomic, strong) NSMutableData* responseData;
我正在尝试在 JSON 请求后加载内容。但是,直到我操作屏幕(例如向下滚动)后,表格才会更新新内容。
我使用[self->mTableView reloadData];
没有效果。另外,在:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
我正在设置:
self.mTableView = tableView;
否则结果根本不会传播到表中。
是否有我遗漏的东西,或者应该将 self.mTableView
定义放在其他地方?
我是 Objective-C 和 iOS 开发的新手,所以如果我遗漏了什么,请告诉我。
最佳答案
你应该:
(1) 将mTableView
连接到Interface Builder中的表格 View 对象。
(2) 请注意,您可以只使用属性表示法 self.mTableView
而不是 self->mTableView
。
(1) 将解决您的问题。 (2) 只是一个风格问题(主要)。
关于objective-c - 不在绘制时更新 UITableViewDelegate,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13766759/