Do not use interface builder for production code; instead, override -loadView. Use autolayout when possible.
/*!
* Method comment.
| #import "PSHCoverFeedViewController.h" | |
| #import "PSHFacebookDataService.h" | |
| #import "PSHCoverFeedPageViewController.h" | |
| #import "PSHMenuViewController.h" | |
| #import "PSHMessagingViewController.h" | |
| #import "FeedItem.h" | |
| #import "ItemSource.h" | |
| @interface PSHCoverFeedViewController ()<UIPageViewControllerDataSource, PSHMenuViewControllerDelegate, PSHCoverFeedPageViewControllerDelegate, PSHMessagingViewControllerDelegate> |
| NSMutableDictionary* pulsePatternsDict = [@{} mutableCopy]; | |
| NSMutableArray* pulsePatternsArray = [@[] mutableCopy]; | |
| // beat for 100 times | |
| for (NSInteger i=0; i<100; i++){ | |
| [pulsePatternsArray addObject:@(YES)]; // vibrate for 100ms | |
| [pulsePatternsArray addObject:@(100)]; | |
| [pulsePatternsArray addObject:@(NO)]; //stop for 1200ms * 0.3 | |
| [pulsePatternsArray addObject:@(1200*0.3)]; |
| #pragma mark - UITableViewDelegate delegate | |
| - (void)scrollViewDidScroll:(UIScrollView *)scrollView { | |
| if (scrollView.contentOffset.y < -160.0f){ | |
| dispatch_once(&pullToDismissLock, ^{ | |
| CGRect destFrame = self.notificationsTableView.frame; | |
| destFrame.origin.y = destFrame.size.height; | |
| [UIView animateWithDuration:0.4f delay:0.0f options:UIViewAnimationOptionCurveEaseOut animations:^{ |
| - (void) fetchNotifications:(FetchNotificationsSuccess)fetchNotificationsSuccess { | |
| InitAccountSuccessBlock successBlock = ^{ | |
| NSURL *url = [NSURL URLWithString:@"https://graph.facebook.com/me/notifications"]; | |
| SLRequest * request = [SLRequest requestForServiceType:SLServiceTypeFacebook requestMethod:SLRequestMethodGET URL:url parameters:@{@"include_read":@"true"}]; | |
| DDLogVerbose(@"request.URL: %@", request.URL); | |
| request.account = self.facebookAccount; | |
| - (void) menuGestureRecognizerAction:(PSHMenuGestureRecognizer*)recognizer { | |
| if (recognizer.state == UIGestureRecognizerStateBegan){ | |
| // began moving | |
| } else if (recognizer.state == UIGestureRecognizerStateChanged){ | |
| CGRect launcherButtonImageViewFrame = [self.view convertRect:self.launcherButtonImageView.frame fromView:self.launcherButtonImageView.superview]; | |
| - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { | |
| UITouch * touch = [touches anyObject]; | |
| CGPoint touchPoint = [touch locationInView:self.view]; | |
| UIView * menuView = [self.view viewWithTag:kPSHMenuViewControllerMenuButtonViewTag]; | |
| if (CGRectContainsPoint(menuView.frame, touchPoint)){ | |
| [self setState:UIGestureRecognizerStateBegan]; | |
| self.menuViewBeingMoved = menuView; | |
| }else{ |
| - (void) animateExpandMenuButtons { | |
| self.launcherButtonView.hidden = NO; | |
| self.notificationsButtonView.hidden = NO; | |
| self.messengerButtonView.hidden = NO; | |
| self.launcherButtonLabel.hidden = NO; | |
| self.notificationsButtonLabel.hidden = NO; | |
| self.messengerButtonLabel.hidden = NO; | |
| [UIView animateWithDuration:0.2f delay:0.0f options:UIViewAnimationOptionCurveEaseInOut animations:^{ |
| /* | |
| // expanded | |
| self.expandedMenuButtonFrame = CGRectMake(120.0f, 458.0f, 90.0f, 90.0f); | |
| self.expandedMessengerButtonFrame = CGRectMake(10.0f, 429.0f, 72.0f, 110.0f); | |
| self.expandedLauncherButtonFrame = CGRectMake(124.0f, 306.0f, 72.0f, 110.0f); | |
| self.expandedNotificationsButtonFrame = CGRectMake(240.0f, 429.0f, 72.0f, 110.0f); | |
| // collapsed | |
| self.collapsedButtonsFrame = CGRectMake(124.0f, 430.0f, 72.0f, 110.0f); | |
| */ |
| 2013-05-01 10:06:06.036 Home[87441:1c03] granted: 1 | |
| 2013-05-01 10:06:06.040 Home[87441:1303] accounts: ( | |
| "type:com.apple.facebook\nidentifier: F5D9D131-7A36-4FFD-A187-A09B07DDF86F\naccountDescription: Facebook\nusername: kenny.sm.tang@gmail.com\nobjectID: x-coredata://92135DD2-592B-4F75-87FF-9965AE7E3B13/Account/p2\nenabledDataclasses: {(\n \"com.apple.Dataclass.Contacts\",\n \"com.apple.Dataclass.Calendars\"\n)}\nenableAndSyncableDataclasses: {(\n)}\nproperties: {\n fullname = \"Kenny Tang\";\n uid = 572733568;\n}\nparentAccount: (null)\nowningBundleID:(null)" | |
| ) |