mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 02:54:11 +08:00
asdf
This commit is contained in:
@ -40,7 +40,7 @@ const Responder = (<any>UIResponder).extend({
|
||||
}
|
||||
}, {
|
||||
protocols: [UIApplicationDelegate]
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
class NotificationObserver extends NSObject {
|
||||
@ -86,6 +86,7 @@ class IOSApplication implements IOSApplicationDefinition {
|
||||
private _observers: Array<NotificationObserver>;
|
||||
private _orientation: "portrait" | "landscape" | "unknown";
|
||||
private _rootView: View;
|
||||
private _userInterfaceStyle: UIUserInterfaceStyle;
|
||||
|
||||
constructor() {
|
||||
this._observers = new Array<NotificationObserver>();
|
||||
@ -97,6 +98,10 @@ class IOSApplication implements IOSApplicationDefinition {
|
||||
this.addNotificationObserver(UIApplicationDidChangeStatusBarOrientationNotification, this.didChangeStatusBarOrientation.bind(this));
|
||||
}
|
||||
|
||||
private asdf(notification: NSNotification) {
|
||||
console.log("---> Yeah!");
|
||||
}
|
||||
|
||||
get orientation(): "portrait" | "landscape" | "unknown" {
|
||||
if (!this._orientation) {
|
||||
const statusBarOrientation = UIApplication.sharedApplication.statusBarOrientation;
|
||||
@ -132,6 +137,14 @@ class IOSApplication implements IOSApplicationDefinition {
|
||||
return this._rootView;
|
||||
}
|
||||
|
||||
get userInterfaceStyle(): UIUserInterfaceStyle {
|
||||
if (!this._userInterfaceStyle) {
|
||||
this._userInterfaceStyle = this._rootView.viewController.traitCollection.userInterfaceStyle;
|
||||
}
|
||||
|
||||
return this._userInterfaceStyle;
|
||||
}
|
||||
|
||||
public addNotificationObserver(notificationName: string, onReceiveCallback: (notification: NSNotification) => void): NotificationObserver {
|
||||
const observer = NotificationObserver.initWithCallback(onReceiveCallback);
|
||||
NSNotificationCenter.defaultCenter.addObserverSelectorNameObject(observer, "onReceive", notificationName, null);
|
||||
@ -389,6 +402,9 @@ export function getNativeApplication(): UIApplication {
|
||||
}
|
||||
|
||||
function getViewController(view: View): UIViewController {
|
||||
|
||||
//
|
||||
|
||||
let viewController: UIViewController = view.viewController || view.ios;
|
||||
if (viewController instanceof UIViewController) {
|
||||
return viewController;
|
||||
|
@ -86,6 +86,14 @@ class UIViewControllerImpl extends UIViewController {
|
||||
this.extendedLayoutIncludesOpaqueBars = true;
|
||||
}
|
||||
|
||||
|
||||
public traitCollectionDidChange(previousTraitCollection: UITraitCollection): void {
|
||||
super.traitCollectionDidChange(previousTraitCollection);
|
||||
|
||||
console.log("---> traitCollectionDidChange");
|
||||
}
|
||||
|
||||
|
||||
public viewWillAppear(animated: boolean): void {
|
||||
super.viewWillAppear(animated);
|
||||
const owner = this._owner.get();
|
||||
|
Reference in New Issue
Block a user