如果设备位于UIImageView
+版本,我试图在UITableView
单元格中隐藏iOS 6.0
。如果设备使用UIImageView
或更低版本,我想显示iOS 6.0
?
下面的代码对我不起作用。我可以在两个版本中看到UIImage
。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//NSLog(@"%@",recentBookName);
static NSString *CellIdentifier = @"Cell";
GMMListViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell.NameLabel.text=[BookName objectAtIndex:indexPath.row];
cell.authorLabel.text=[AuthorName objectAtIndex:indexPath.row];
if([[[UIDevice currentDevice]systemVersion] floatValue]<6.0){
cell.rupeeSymbol.hidden=NO;
}else{
cell.rupeeSymbol.hidden=YES;
}
return cell;
}
答案 0 :(得分:4)
添加以下代码
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
到projectName-Perfix.pch
文件,以便您可以从项目的任何位置访问它。
以上代码无需进行额外的重复工作。
只需将条件设置为(项目中的任意位置)
if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"6") )
{
// do your stuff for iOS >= 6
}
els
{
// do your stuff for iOS <= 6
}