如何在iPhone sdk中比较数据
我正在使用条件,但它不会转到if条件,每次都转到else条件如何在iPhone sdk中比较数据,iphone,web-services,Iphone,Web Services,我正在使用条件,但它不会转到if条件,每次都转到else条件 if ([[dict2 valueForKey:@"meeting_location"] isEqual:@""]) { lbllocation.text = @"-----"; } else { lbllocation.text = [NSString stringWithFormat:@"Location: %@",[dict2 valueForKey:@"mee
if ([[dict2 valueForKey:@"meeting_location"] isEqual:@""])
{
lbllocation.text = @"-----";
}
else
{
lbllocation.text = [NSString stringWithFormat:@"Location: %@",[dict2 valueForKey:@"meeting_location"]];
}
输出来自Webservice:-
"meeting_location" = "";
"meeting_time" = "";
"meeting_with" = "";
使用以下代码-
if ([[dict2 valueForKey:@"meeting_location"] length] == 0)
{
lbllocation.text = @"-----";
}
else
{
lbllocation.text = [NSString stringWithFormat:@"Location: %@",[dict2 valueForKey:@"meeting_location"]];
}
希望这能在这里起作用。使用下面的代码
if ([[dict2 valueForKey:@"meeting_location"] length] == 0)
{
lbllocation.text = @"-----";
}
else
{
lbllocation.text = [NSString stringWithFormat:@"Location: %@",[dict2 valueForKey:@"meeting_location"]];
}
希望这能在这里起作用