Zhe*_*hen 1 cocoa-touch objective-c string-comparison uilabel ios
我试图实现下面的代码,但没有成功.基本上,我想设置显示名称,thisPhoto.userFullName如果它不是'空白',否则显示thisPhoto.userName.
UILabel *thisUserNameLabel = (UILabel *)[cell.contentView viewWithTag:kUserNameValueTag];
NSLog(@"user full name %@",thisPhoto.userFullName);
NSLog(@"user name %@",thisPhoto.userName);
if (thisPhoto.userFullName && ![thisPhoto.userFullName isEqual:[NSNull null]] )
{
thisUserNameLabel.text = [NSString stringWithFormat:@"%@",thisPhoto.userFullName];
}
else if (thisPhoto.userFullName == @"")
{
thisUserNameLabel.text = [NSString stringWithFormat:@"%@",thisPhoto.userName];
}
Run Code Online (Sandbox Code Playgroud)
目前,即使userFullName是空白,我userName仍然没有显示在屏幕上.
| 归档时间: |
|
| 查看次数: |
2368 次 |
| 最近记录: |