Reputation: 165
Iam trying to hide a UIImageView
in UITableView
cell ,if the device is in iOS 6.0
+ version. and i wanna show the UIImageView
if the device using iOS 6.0
or lower version ?
Below code is not working for me.I can see the UIImage
in both versions.
- (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;
}
Upvotes: 2
Views: 652
Reputation: 47079
Add following code
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
To your projectName-Perfix.pch
file so you can access it from anywhere in your project.
This above code is for no need to do extra repeat work.
And just put condition such like (Anywhere in your project)
if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"6") )
{
// do your stuff for iOS >= 6
}
els
{
// do your stuff for iOS <= 6
}
Upvotes: 4