I got it to work by overriding the root viewcontroller and attach my "main" viewcontroller to that. Maybe there is a better way to work and do this, this is one way.
In your AppDelegate (applicationDidFinishLaunch method)
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//Override rootviewcontroller with an empty viewcontroller
window.rootViewController = [[UIViewController alloc] init];
//Setup my custom viewcontroller
MyViewController *vc = [[MyViewController alloc] init];
[vc setModalPresentationStyle:UIModalPresentationFullScreen];
[window.rootViewController addChildViewController:vc];
[window.rootViewController.view addSubview:vc.view];
// Put in the desired size and position.
vc.view.frame = CGRectMake(10.0, 100.0, 300.0, 100.0);
...
Just for fun. If you are doing your project with StoryBoard, same process but fetching the StoryBoard identifier. Note that in this case you must set the StoryBoard ID in Interface Builder for your main viewcontroller.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
// Fetch viewcontroller from the storyboard ID that you have set in Interface Builder
UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"MyMainViewController"];
[vc setModalPresentationStyle:UIModalPresentationFullScreen];
[window.rootViewController addChildViewController:vc];
[window.rootViewController.view addSubview:vc.view];
// Put in the disired size and position.
vc.view.frame = CGRectMake(10.0, 100.0, 300.0, 100.0);
...