我安裝我的視圖控制器內的UITableView控制器如下:設置視圖控制器內的UITableView編程方式
fieldView = [[UITableView alloc] initWithFrame:CGRectMake(0, logoView.bounds.size.height, 320, (screen.size.height - logoView.bounds.size.height)) style:UITableViewStylePlain];
[fieldView setBackgroundColor:[UIColor greenColor]];
fieldView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleTopMargin;
視圖控制器是設置成爲TableViewDelegate如下:
UIViewController <UITableViewDelegate, UITableViewDataSource...
問題:我需要做什麼來查看委託方法,以便他們控制這個添加的子視圖?
#pragma mark -
#pragma Table View Delegate Methods
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
NSLog(@"Here");
return 1;
}
- (NSString *)tableView:(UITableView *)fieldView titleForHeaderInSection:(NSInteger)section {
NSString *sectionName;
NSLog(@"Here2");
上面的方法是在視圖控制器,但沒有調用?
'tableView:cellForRowAtIndexPath' there? – Larme 2013-02-18 17:51:20