Skip to content

Instantly share code, notes, and snippets.

@wethu
Last active August 29, 2015 14:24
Show Gist options
  • Save wethu/424159dec01ae8b7d1b0 to your computer and use it in GitHub Desktop.
Save wethu/424159dec01ae8b7d1b0 to your computer and use it in GitHub Desktop.
//
// AppDelegate.m
// codeonly
//
// Created by Ellis Gray on 23/06/2015.
// Copyright (c) 2015 Ellis Gray. All rights reserved.
//
#import "AppDelegate.h"
@interface AppDelegate () <UITableViewDataSource, UITableViewDelegate>
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
_window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *controller = [UIViewController new];
UICollectionViewLayout *layout = [[UICollectionViewLayout alloc]init];
UICollectionView *collectionView = [[UICollectionView alloc]initWithFrame:CGRectMake(100, 100, 100, 100) collectionViewLayout:layout];
collectionView.backgroundColor = [UIColor whiteColor];
[controller.view addSubview:collectionView];
[controller.view layoutIfNeeded];
CGFloat height = collectionView.frame.size.height * 0.626f;
NSLog(@"Height: %f", height); // I get 62.59999999
_window.rootViewController = controller;
[_window makeKeyAndVisible];
return YES;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment