-2

我想问一下当我使用表视图时发生的崩溃,我不知道如何解决它首先我尝试将调试器从 LLDB 更改为 GDB,但没有任何改变,现在我正在使用 Xcode 5 但是我仍然有同样的问题问题是:

int main(int argc, char * argv[])
{
    @autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
    }
}

在控制台中:

argc = (int) 1 
argv = (char **) 0xbfffee4c
4

1 回答 1

-2

如果您使用的是tableView,首先您需要实现UITableViewDataSource, UITableViewDelegate协议的数据源和委托方法,这些是您需要实现的方法

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{

       return number_of_rows;
}



- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
    cell.textLabel.text = @"some text you want to show";
    cell.imageView.image = @"some image";

    return cell;

}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

    // do some action like push next view controller and pass the data  
}

检查您是否已连接数据源并将情节提要中的委托给您的文件所有者。 看图片并为代表做同样的事情

于 2013-11-02T06:31:04.880 回答