Skip to content

Instantly share code, notes, and snippets.

@wagyu298
wagyu298 / gist:5810889
Created June 19, 2013 00:58
didSelectItemAtIndexPath of MainViewController.m from iPhone flat design UI http://www.appdesignvault.com/iphone-flat-ui-design-patterns/.
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
StoryboardInfo* storyboardInfo = self.storyboards[indexPath.section];
ControllerInfo* controllerInfo = storyboardInfo.controllers[indexPath.row];
self.currentViewController = [self getControllerFromStoryboardInfo:storyboardInfo andControllerInfo:controllerInfo];
UIViewController* controller = self.currentViewController;
controller.view.frame = CGRectMake(0, 0, controller.view.frame.size.width, controller.view.frame.size.height);
@wagyu298
wagyu298 / gist:5802089
Created June 18, 2013 01:58
This is a code snippet to control UITextView's contentInset.bottom and scrollIndicatorInset.bottom when iPhone's keyboard status is changed to visible or hide.
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
[notificationCenter addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
[notificationCenter addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
}
- (void)viewDidDisappear:(BOOL)animated
{