NavigationController: alignment problem

Hi!

I have a TTMSFMXNativeUINavigationController and some TTMSFMXNativeUIViewControllers on the form. For all controllers
Align := alClient. If I push an ViewController in the NavigationController, the upper part of the target ViewController is overlapped by the NavigationBar. Is there a possibility to position ViewControllers automatically correct under the NavigationBar without manual set y-position and height for each controller? (XE5 + last version iCL)

Best regards,
Vitaly

Hi, 


Are you using iOS 7?
If so, you will need to use the following code that sets the viewcontroller extended edges (include the unit Macapi.ObjectiveC and Macapi.ObjcRuntime.

  objc_msgSend((TMSFMXNativeUIViewController1.ViewController as ILocalObject).GetObjectID,sel_getUid('setEdgesForExtendedLayout:'), 0);

In iOS 7, the ViewController is automatically stretched under the navigation bar and under the statusbar by default. This means that in combination with the statusbar, the offset of the control inside the UIViewController needs to start at 44 pixels (height of the navigation bar). (We have already included the 20 pixel statusbar offset).

This is explained at the following page:
http://https://developer.apple.com/library/ios/documentation/userexperience/conceptual/transitionguide/AppearanceCustomization.html

Kind Regards, 
Pieter

Pieter Scheldeman2014-01-20 08:31:00

Hi Pieter,

Thank You for this solution.
But now i habe a another problem: after pushing
the NaviationBar changes the alpha and is semi-transparent. Is there a solution for this?

Ok, solved.
Solution:

TMSFMXNativeUINavigationController1.NavigationController.navigationBar.setTranslucent(false);

Thank You for support!