mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +08:00
Merge pull request #2146 from NativeScript/app-delegate
iOS App delegate example added
This commit is contained in:
@ -19,4 +19,25 @@ if (app.ios) {
|
|||||||
if (app.ios) {
|
if (app.ios) {
|
||||||
app.ios.removeNotificationObserver(observer, UIDeviceBatteryLevelDidChangeNotification);
|
app.ios.removeNotificationObserver(observer, UIDeviceBatteryLevelDidChangeNotification);
|
||||||
}
|
}
|
||||||
// << application-ios-observer
|
// << application-ios-observer
|
||||||
|
|
||||||
|
// >> application-ios-delegate
|
||||||
|
//// Add custom application delegate
|
||||||
|
if (app.ios) {
|
||||||
|
class MyDelegate extends UIResponder implements UIApplicationDelegate {
|
||||||
|
public static ObjCProtocols = [UIApplicationDelegate];
|
||||||
|
|
||||||
|
applicationDidFinishLaunchingWithOptions(application: UIApplication, launchOptions: NSDictionary): boolean {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
applicationDidBecomeActive(application: UIApplication): void {
|
||||||
|
// Get reference to the application window.
|
||||||
|
//console.log("keyWindow: " + application.keyWindow);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
app.ios.delegate = MyDelegate;
|
||||||
|
}
|
||||||
|
|
||||||
|
// << application-ios-delegate
|
Reference in New Issue
Block a user