I have change the main() function in main.m file, like this:
#import <UIKit/UIKit.h>
#import "ViewController.h"
#import "SDL.h"
extern C_LINKAGE int SDL_main(int argc, char * argv[])
{
@autoreleasepool {
ViewController *viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
[UIApplication sharedApplication].keyWindow.rootViewController = viewController;
[[UIApplication sharedApplication].keyWindow makeKeyAndVisible];
return 0;
}
}
In ViewController.m
do dome SDL jobs, so AppDelegate.h/m are no need. Then SDL's window and UIKit's windows swap each other sometimes.
BTW, in an iOS project integrated with SDL, UIKit support some UIWindow and SDL support some SDL_Window, project will generate SDLUIKitDelegate
, SDL_uikitopenglview
.