Skip to content

Commit

Permalink
An example implementation of reloading content after a period of time…
Browse files Browse the repository at this point in the history
…. We can say this is a simulation of remote content fetching.
  • Loading branch information
Ilter Cengiz committed Dec 16, 2013
1 parent 22163e8 commit 623ba0d
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion ICViewPager/Controller/HostViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

@interface HostViewController () <ViewPagerDataSource, ViewPagerDelegate>

@property (nonatomic) NSUInteger numberOfTabs;

@end

@implementation HostViewController
Expand All @@ -36,16 +38,39 @@ - (void)viewDidLoad {

button;
});

}
- (void)viewDidAppear:(BOOL)animated {

[super viewDidAppear:animated];

[self performSelector:@selector(loadContent) withObject:nil afterDelay:3.0];

}

- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

#pragma mark - Setters
- (void)setNumberOfTabs:(NSUInteger)numberOfTabs {

// Set numberOfTabs
_numberOfTabs = numberOfTabs;

// Reload data
[self reloadData];

}

#pragma mark - Helpers
- (void)selectTabWithNumberFive {
[self selectTabAtIndex:5];
}
- (void)loadContent {
self.numberOfTabs = 10;
}

#pragma mark - Interface Orientation Changes
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
Expand All @@ -56,7 +81,7 @@ - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrie

#pragma mark - ViewPagerDataSource
- (NSUInteger)numberOfTabsForViewPager:(ViewPagerController *)viewPager {
return 10;
return self.numberOfTabs;
}
- (UIView *)viewPager:(ViewPagerController *)viewPager viewForTabAtIndex:(NSUInteger)index {

Expand Down

0 comments on commit 623ba0d

Please sign in to comment.