I have a class definition as follows:
@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;
I’m trying to load contents after a JSON request. However, the table doesn’t update with the new contents until after I manipulate the screen (e.g., scroll down).
I am using [self->mTableView reloadData]; to no effect. Also, in:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
I’m setting:
self.mTableView = tableView;
Otherwise the results don’t propagate to the table at all.
Is there something I’m missing, or should that self.mTableView definition be placed elsewhere?
I’m new to Objective-C and iOS development, so if I’m leaving something out, please let me know.
You should:
(1) Connect
mTableViewto the table view object in Interface Builder.(2) Note that you can just use property notation
self.mTableViewrather thanself->mTableView.(1) will fix your problem. (2) is just a style issue (mainly).