2025-04-19 15:05:22 +08:00

31 lines
1.2 KiB
Objective-C

#import "ExampleAppDelegate.h"
#import "ExampleUIWebViewController.h"
#import "ExampleWKWebViewController.h"
@implementation ExampleAppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// 1. Create the UIWebView example
ExampleUIWebViewController* UIWebViewExampleController = [[ExampleUIWebViewController alloc] init];
UIWebViewExampleController.tabBarItem.title = @"UIWebView";
// 2. Create the tab footer and add the UIWebView example
UITabBarController *tabBarController = [[UITabBarController alloc] init];
[tabBarController addChildViewController:UIWebViewExampleController];
// 3. Create the WKWebView example for devices >= iOS 8
if([WKWebView class]) {
ExampleWKWebViewController* WKWebViewExampleController = [[ExampleWKWebViewController alloc] init];
WKWebViewExampleController.tabBarItem.title = @"WKWebView";
[tabBarController addChildViewController:WKWebViewExampleController];
}
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.rootViewController = tabBarController;
[self.window makeKeyAndVisible];
return YES;
}
@end