我正在使用条件,但它没有进入if条件,每次都进入else条件。
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" = "";
答案 0 :(得分:3)
使用以下代码 -
if ([[dict2 valueForKey:@"meeting_location"] length] == 0)
{
lbllocation.text = @"-----";
}
else
{
lbllocation.text = [NSString stringWithFormat:@"Location: %@",[dict2 valueForKey:@"meeting_location"]];
}
希望这可以在这里工作。