这可不容易吗?
原文链接:https://www.f2er.com/swift/319592.html@UIApplicationMain class AppDelegate: UIResponder,UIApplicationDelegate { var window: UIWindow? func application(application: UIApplication!,didFinishLaunchingWithOptions launchOptions: NSDictionary!) -> Bool { self.window = UIWindow(frame: UIScreen.mainScreen().bounds) // ... self.window!.tintColor = UIColor.orangeColor() return true } }
这是Swift等同于Objective-C:
@interface AppDelegate <UIResponder,UIApplicationDelegate> @property (nonatomic,strong) UIWindow *window; @end @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // ... self.window.tintColor = [UIColor orangeColor]; return YES; } @end