Created
January 23, 2013 16:15
-
-
Save radianttap/4608892 to your computer and use it in GitHub Desktop.
Never initialize multiple UICollectionViewControllers with the same UICollectionViewLayout instance
This file contains hidden or 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
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | |
// this subclass defines itemsSize as {320, 88} | |
MyUICollectionViewFlowLayout *l = [[MyUICollectionViewFlowLayout alloc] init]; | |
// initialize one subclass of UICollectionViewController | |
MainViewController *mvc = [[MainViewController alloc] initWithCollectionViewLayout:l]; | |
// initialize another with same layout | |
// but inside this init method do: | |
// l.itemSize = CGSizeMake(320,44) | |
SecondViewController *novc = [[SecondViewController alloc] initWithCollectionViewLayout:l]; | |
// that change 44 is also applied to MainViewController layout | |
self.tabBarController = [[UITabBarController alloc] init]; | |
self.tabBarController.viewControllers = @[mvc, novc]; | |
self.window.rootViewController = self.tabBarController; | |
// in hindsight, this was really stupid thing to do, but it's an easy copy/paste error to do. | |
// grumpf. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment