- (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];
}
}
答案 0 :(得分:2)
我会尝试使用if (boy == nil)
,但这似乎也不起作用。
而是这样做:
NSString *str = [NSString stringWithFormat:@"%@", boy];
if ([str isEqualToString:@""]) {
//boy is nil do your stuff
}
答案 1 :(得分:1)
替换
if (boy == NULL)
带
if ([boy count] == 0)
答案 2 :(得分:-1)
修改你的if条件如下,看看是否有效。
((boy == NULL) || ([boy count] == 0))