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