Phi*_*lip 1 iphone objective-c uitableview
我有这个代码来填充UITableView,返回numberOfRowsInSection的工作正常.不调用在cellForRowAtIndexPath部分中使用appDelegate的选择器.这里有什么不对?
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
// Return the number of rows in the section.
VIP_GeburtstagAppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
[appDelegate getEntriesForDate:section];
return appDelegate.namesForDay.count;
}
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)theTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
VIP_GeburtstagAppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
[appDelegate getEntriesForDate:indexPath.section];
Run Code Online (Sandbox Code Playgroud)
方法被称为.选择器是(或多或少)方法的名称; 他们没有被召唤.
如果-tableView:numberOfRowsInSection:
返回0,则没有单元格,因此不会调用-tableView:cellForRowAtIndexPath:
.