【发布时间】:2011-09-18 02:21:05
【问题描述】:
我在视图中有一个基于视图的应用程序和一个 UITableview。 当我单击 tableview 时,我将 dataSource 、 delegate 和 tableView 设置为“File's Owner” 然后单击 Files 所有者,我将 tableView 设置为 Table View , view 设置为 View , datasource 设置为 Table View 并委托给网点中的 Table view 。
- (void)viewDidLoad
{
[super viewDidLoad];
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)videoView {
return 1;
}
// Customize the number of rows in the table view.
- (NSInteger)videoView:(UITableView *)videoView numberOfRowsInSection:(NSInteger)section {
return 0;
}
// Customize the appearance of table view cells.
- (UITableViewCell *)videoView:(UITableView *)videoView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [videoView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
}
// Set up the cell...
return cell;
}
- (void)tableView:(UITableView *)videoView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
当我为模拟器运行应用程序时,我收到以下错误 "tableView:numberOfRowsInSection:]: 无法识别的选择器发送到实例 0x6029710 "
我觉得在基于视图的应用程序而不是基于导航的应用程序中使用时,tableviews 需要不同的实现。如果有人能指导我如何正确显示此内容,我将不胜感激。谢谢。
【问题讨论】:
标签: iphone uitableview xcode4