Following the accepted answer to How to create an Empty Application in Xcode 6 without Storyboard I managed to have an empty application working in Xcode 8 (in Objective-C).
These are the steps that I took:
- File > New > Project > Single View Application
- Deleted
Main.storyboard
and its reference ininfo.plist
("Main storyboard file base name") - Deleted
LaunchScreen.storyboard
and its reference ininfo.plist
("Launch screen interface file base name") - At the top of "AppDelegate.m" added the import statement
#import "ViewController.h"
Edited applicationDidFinishLaunchingWithOptions with this code:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customization after application launch. self.window.rootViewController = [[ViewController alloc] init]; self.window.backgroundColor = [UIColor whiteColor]; [self.window makeKeyAndVisible]; return YES; }
If I follow these steps the screen of my app won't occupy the whole screen of the simulator, but only a portion. Following @tboyce12's comment to the accepted answer I made a second version, in which I didn't remove the LaunchScreen.storyboard file, so that the app finally occupied the whole screen of the simulator.
Is there a way of doing this programmatically?