私はjsonファイルを解析しています。boy.itという名前の変数にデータがない場合、ロジックはこのようになり、ifループに入る必要があり、データがある場合はelse部分問題.butループはまだコードである他part..cud uのみんなが私を助けてout..below入り(コンソールで空を示している)変数少年が空でも..ですif文の問題
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Navigation logic may go here. Create and push another view controller.
NSDictionary *boy=[url objectAtIndex:indexPath.row];
NSLog(@"the boy value:%@",boy);
if (boy == NULL)
{
Secondetailview *detailViewController1 = [[Secondetailview alloc] initWithItem:boy];
[self.navigationController pushViewController:detailViewController1 animated:YES];
[detailViewController1 release];
}else
{
FirstViewDetail *detailViewController = [[FirstViewDetail alloc] initWithItem:boy];
[self.navigationController pushViewController:detailViewController animated:YES];
[detailViewController release];
}
}
mkayで
を交換して...私は、もしループに入ることがnil..stillことができません使用してみました... U・ディクショナリのためノー任意のシンボルを行います.. – kingston
は全く同じです – hamstergene
-1そうではありません。 Objective-CはC/C++にぶつかっているので、 'nil' ==' NULL' == '0'(おおよそ最後のもの)です。しかし、 'nil'を使うのは、Objective-Cではもっと慣用的に正しいです。:-) –