Skip to content
Browse files

moved loading view handling to CLCGVC. Reset backgroundView only for …

…grouped TVVC.
  • Loading branch information...
1 parent 3f792f6 commit aa207a91e07525c73ada5134ab660d5aaa2028d8 @ettore committed
Showing with 28 additions and 13 deletions.
  1. +9 −13 CLCGTVVC.m
  2. +19 −0 CLCGVC.m
View
22 CLCGTVVC.m
@@ -125,25 +125,21 @@ -(void)viewDidLoad
{
[super viewDidLoad];
- // necessary to avoid default striped background for grouped tableviews
- [mTableView setBackgroundView:nil];
+ if ([mTableView style] == UITableViewStyleGrouped) {
+ // necessary to avoid default striped background for grouped tableviews
+ [mTableView setBackgroundView:nil];
+ }
}
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
- switch ([self loadState]) {
- case CLCG_LOADING:
- [self showLoadingView:YES];
- break;
- default: {
- UITableView *tv = [self tableView];
- [self showLoadingView:NO];
- if ([tv indexPathForSelectedRow])
- [tv deselectRowAtIndexPath:[tv indexPathForSelectedRow] animated:YES];
- break;
- }
+
+ if ([self loadState] != CLCG_LOADING) {
+ UITableView *tv = [self tableView];
+ if ([tv indexPathForSelectedRow])
+ [tv deselectRowAtIndexPath:[tv indexPathForSelectedRow] animated:YES];
}
}
View
19 CLCGVC.m
@@ -95,6 +95,25 @@ -(void)showLoadingView:(BOOL)show
}
+-(void)viewWillAppear:(BOOL)animated
+{
+ [super viewWillAppear:animated];
+
+ switch ([self loadState]) {
+ case CLCG_LOADING:
+ // the reason why we're showing the loading view here and not earlier
+ // is because earlier, eg at viewDidLoad time, the view is not really
+ // laid out (e.g. frame is Zero)
+ [self showLoadingView:YES];
+ break;
+ default: {
+ [self showLoadingView:NO];
+ break;
+ }
+ }
+}
+
+
-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)to_orient
duration:(NSTimeInterval)duration
{

0 comments on commit aa207a9

Please sign in to comment.
Something went wrong with that request. Please try again.