diff --git a/ui/action-bar/action-bar.ios.ts b/ui/action-bar/action-bar.ios.ts index e05b3e671..a5636562c 100644 --- a/ui/action-bar/action-bar.ios.ts +++ b/ui/action-bar/action-bar.ios.ts @@ -29,7 +29,21 @@ export class NavigationButton extends ActionItem { } export class ActionBar extends common.ActionBar { - public update() { + + get ios(): UIView { + + if (!(this.page && this.page.parent)) { + return; + } + + let viewController = (this.page.ios); + if (viewController.navigationController !== null) { + return viewController.navigationController.navigationBar; + } + return null; + } + + public update() { // Page should be attached to frame to update the action bar. if (!(this.page && this.page.parent)) { return; @@ -38,7 +52,7 @@ export class ActionBar extends common.ActionBar { var viewController = (this.page.ios); var navigationItem: UINavigationItem = viewController.navigationItem; var navController = frameModule.topmost().ios.controller; - var navigationBar = navController.navigationBar; + var navigationBar = navController ? navController.navigationBar : null; var previousController: UIViewController; // Set Title @@ -53,7 +67,7 @@ export class ActionBar extends common.ActionBar { if (indexOfViewController < navController.viewControllers.count && indexOfViewController > 0) { previousController = navController.viewControllers[indexOfViewController - 1]; } - + // Set back button text if (previousController) { if (this.navigationButton) { @@ -250,6 +264,10 @@ export class ActionBar extends common.ActionBar { super.onLayout(left, top, right, bottom); } + public layoutNativeView(left: number, top: number, right: number, bottom: number) { + return; + } + public _shouldApplyStyleHandlers() { var topFrame = frameModule.topmost(); return !!topFrame;