即时解析一个JSON文件。逻辑是这样的,如果没有数据名为boy.it的变量需要进入if循环,并且如果有数据进入else部分。但问题是,即使变量男孩是空的(这表明在控制台空)环路仍然进入别人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无法进入,如果环...做ü没有的词典中的任何符号 – kingston
那是绝对一样的 – hamstergene
-1不正确。 'nil' =='NULL' =='0'(大致在最后一个),因为Objective-C只是挂在C/C++上。然而,在Objective-C中使用'nil'确实是更正确的:-) – 2011-08-18 05:24:45