Iphone 在modalViewController中使用indexPath.row时崩溃
我的indexPath.row有问题,当我尝试访问此变量时,我的应用程序崩溃,控制台上没有错误:( 代码如下:Iphone 在modalViewController中使用indexPath.row时崩溃,iphone,uitableview,modalviewcontroller,nsindexpath,Iphone,Uitableview,Modalviewcontroller,Nsindexpath,我的indexPath.row有问题,当我尝试访问此变量时,我的应用程序崩溃,控制台上没有错误:( 代码如下: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // Navigation logic may go here. Create and push another view controller. NSLog(@"%@", index
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Navigation logic may go here. Create and push another view controller.
NSLog(@"%@", indexPath); //works fine
NSLog(@"%@", indexPath.row); //crash
}
我在ModalViewController中使用它。您必须使用
NSLog(@"%d", indexPath.row);
而不是
NSLog(@"%@", indexPath.row);
这是因为,indexath.row是一个整数,您必须使用%d