Bug 24484 - NavigationRenderer.ParentingViewController breaks things
Summary: NavigationRenderer.ParentingViewController breaks things
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.2.3
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2014-11-13 01:05 UTC by Adam Kemp
Modified: 2015-07-01 00:05 UTC (History)
6 users (show)

Is this bug a regression?: ---
Last known good build:

Description goes here. (7.59 MB, application/zip)
2014-11-13 01:05 UTC, Adam Kemp

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Adam Kemp 2014-11-13 01:05:05 UTC
See this discussion:

There are two problems with the parenting view controller:

1. It doesn't forward EdgesForExtendedLayout to its child, which breaks layout for custom page renderers in the case of a translucent navigation bar.
2. It doesn't call DidMoveToParentViewController, which violates the contract of adding a child view controller. See the Apple documentation.

In the attached project you can see the layout issue (issue 1). For the second issue try adding this to LoginMenuPageRenderer:

        public override void DidMoveToParentViewController(UIViewController parent)

            if (parent != null)
                parent.EdgesForExtendedLayout = UIRectEdge.None;

Observe that the method is never called. It should be called in NavigationRenderer.OnPushAsync(Page, bool) right here:


That should be:

        var viewController = Platform.GetRenderer(page).ViewController;
Comment 1 Adam Kemp 2014-11-13 01:05:42 UTC
Created attachment 8715 [details]
Description goes here.
Comment 2 Arpit Jha 2014-12-29 07:30:26 UTC
I have checked this issue with the help of bug description and observed the following
1. NavigationPage rendering having layout issue at bottom of rendered page as mentioned in bug description.
2.After adding code mentioned in bug description observed that method never called

Please let me know you are talking about same behaviour for second issue and let me know if i missed anything to reproduce it?

Screencast: http://www.screencast.com/t/nMVrYoX2hL
Ide log : https://gist.github.com/Arpit360/5c1129615c5d23561eae
iOS device log : https://gist.github.com/Arpit360/8ce36bc4c663c33f5e4f

Environment Info:
=== Xamarin Studio ===

Version 5.5.4 (build 15)
Installation UUID: 3d25a767-a003-4a7d-9f5e-e57987cf6cf0
	Mono 3.10.0 ((detached/92c4884)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 310000031

=== Apple Developer Tools ===

Xcode 6.1 (6602)
Build 6A1052c

=== Xamarin.Mac ===

Version: (Enterprise Edition)

=== Xamarin.Android ===

Version: (Enterprise Edition)
Android SDK: /Users/mac360_xamarin/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		4.0.3 (API level 15)
		4.4   (API level 19)
		5.0   (API level 21)
Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

=== Xamarin.iOS ===

Version: (Enterprise Edition)
Hash: 840a925
Build date: 2014-11-16 21:03:22-0500

=== Build Information ===

Release ID: 505040015
Git revision: f93940a35458a18052f1a25e106e62ca970d9c40
Build date: 2014-11-19 15:32:41-05
Xamarin addins: dc23cbd91a3a0e1d326328e1229e86c942a49ec8

=== Operating System ===

Mac OS X 10.10.0
Darwin mac360-xamarins-Mac-mini.local 14.0.0 Darwin Kernel Version 14.0.0
    Fri Sep 19 00:26:44 PDT 2014
    root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64
Comment 3 Adam Kemp 2014-12-29 10:33:56 UTC
The second issue is that DidMoveToParentViewController is never called. It sounds like you did reproduce it.
Comment 4 Arpit Jha 2014-12-29 23:10:40 UTC
As per comment 3 .I am going to change status to Confirm.
Comment 5 Jason Smith [MSFT] 2015-03-09 21:13:37 UTC
Should be fixed in 1.4.1-pre1
Comment 6 Adam Kemp 2015-03-10 12:26:48 UTC
It appears that you only fixed the second issue. What are you doing about the first issue? The first issue is that many things you would want to set in a custom page renderer will have no effect if they are placed in a navigation page because the wrapper view controller is too dumb. It doesn't try to mirror the properties of the contained view controller. It's a leaky abstraction, and it makes a lot of things much harder.