[iOS] IPad changed cells colour.

This commit is contained in:
Kirill Zhdanovich 2013-08-10 15:39:13 +03:00
parent 28d16dd60a
commit b4e9bd6899
2 changed files with 30 additions and 3 deletions

View file

@ -16,6 +16,7 @@
Storage m_storage;
CLLocationCoordinate2D m_lastLocation;
NSDate * m_lastLocationTime;
int m_currentPath;
}
@property (nonatomic, strong) UISearchBar * searchBar;
@ -68,6 +69,7 @@
m_storage.QueryArticleInfo(string(), self.locationManager.location.coordinate.latitude, self.locationManager.location.coordinate.longitude);
else
m_storage.QueryArticleInfo(string());
m_currentPath = 0;
[self.tableView reloadData];
}
return self;
@ -77,6 +79,8 @@
{
[super viewDidLoad];
[self.searchBar sizeToFit];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
self.tableView.backgroundColor = [UIColor colorWithRed:51.f/255.f green:51.f/255.f blue:51.f/255.f alpha:1.f];
}
#pragma mark - Table view data source
@ -118,6 +122,14 @@
UIImage * image = [UIImage imageWithContentsOfFile:imagePath];
cell.mainImage.image = image;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
if (m_currentPath == indexPath.row)
cell.contentView.backgroundColor = [UIColor colorWithRed:28.f/255.f green:28.f/255.f blue:28.f/255.f alpha:1.f];
else
cell.contentView.backgroundColor = [UIColor colorWithRed:40.f/255.f green:40.f/255.f blue:40.f/255.f alpha:1.f];
}
return (UITableViewCell *)cell;
}
@ -134,16 +146,19 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// @todo Show details guide info
[self.tableView deselectRowAtIndexPath:indexPath animated:YES];
ArticleInfo const * info = [self infoByIndexPath:indexPath];
GuideVC * vc = [[GuideVC alloc] init];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
[self.navigationController pushViewController:vc animated:YES];
NSString * url = [NSString stringWithUTF8String:info->GetUrl().c_str()];
[vc loadPage:url];
[self.delegate selectHtmlPageUrl:url];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
m_currentPath = indexPath.row;
[self.tableView reloadData];
}
}
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView

View file

@ -14,7 +14,19 @@
self.mainTitile.font = [UIFont fontWithName:@"Helvetica-Regular" size:25];
self.subTitile.backgroundColor = [UIColor clearColor];
self.subTitile.font = [UIFont fontWithName:@"Helvetica-Light" size:13];
self.subTitile.textColor = [UIColor colorWithRed:51.f/255.f
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
self.mainTitile.textColor = [UIColor colorWithRed:1.f
green:1.f
blue:1.f
alpha:1.f];
self.subTitile.textColor = [UIColor colorWithRed:1.f
green:1.f
blue:1.f
alpha:1.f];
}
else
self.subTitile.textColor = [UIColor colorWithRed:51.f/255.f
green:51.f/255.f
blue:51.f/255.f
alpha:1.f];