Created
January 7, 2014 22:13
-
-
Save kenshin03/8307914 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)setupViewFrameBounds | |
{ | |
CGRect screenBounds = [[UIScreen mainScreen] bounds]; | |
self.view.frame = screenBounds; | |
} | |
- (void)setupNavigationBar | |
{ | |
self.navigationController.navigationBarHidden = YES; | |
self.navigationItem.hidesBackButton = YES; | |
} | |
- (void)addSubviewTree | |
{ | |
[self.view addSubview:self.menuViewController.view]; | |
[self.view bringSubviewToFront:self.menuViewController.view]; | |
} | |
- (void)setUpCoverFlowPagesViewController | |
{ | |
if ([self.feedItemsArray count] == 0){ | |
// fail fast. do nothing | |
return; | |
} | |
// set up page view controllers | |
FeedItem * firstFeedItem = self.feedItemsArray[0]; | |
PSHCoverFeedPageViewController * currentPagePageViewController = [[PSHCoverFeedPageViewController alloc] init]; | |
currentPagePageViewController.feedType = firstFeedItem.type; | |
currentPagePageViewController.messageLabelString = firstFeedItem.message; | |
currentPagePageViewController.infoLabelString = [NSString stringWithFormat:@"%@ - %@", [self.dateFormatter stringFromDate:firstFeedItem.updatedTime], firstFeedItem.source.name]; | |
currentPagePageViewController.likesCount = [firstFeedItem.likesCount integerValue]; | |
currentPagePageViewController.commentsCount = [firstFeedItem.commentsCount integerValue]; | |
currentPagePageViewController.lastestCommentatorsString = firstFeedItem.latestCommentors; | |
currentPagePageViewController.feedItemGraphID = firstFeedItem.graphID; | |
currentPagePageViewController.feedType = firstFeedItem.type; | |
currentPagePageViewController.likedByMe = firstFeedItem.likedByMe.boolValue; | |
currentPagePageViewController.currentIndex = 0; | |
if (firstFeedItem.imageURL != nil){ | |
currentPagePageViewController.imageURLString = firstFeedItem.imageURL; | |
} | |
currentPagePageViewController.sourceName = firstFeedItem.source.name; | |
currentPagePageViewController.sourceAvartarImageURL = firstFeedItem.source.imageURL; | |
currentPagePageViewController.delegate = self; | |
[self.feedsPageViewController setViewControllers:@[currentPagePageViewController] direction:UIPageViewControllerNavigationDirectionForward animated:YES completion:^(BOOL finished) { | |
}]; | |
// override local gesture recognizers | |
self.view.gestureRecognizers = self.feedsPageViewController.gestureRecognizers; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment