Bug 21606

Summary: Page Title not updating when set in OnAppearing() Method the second time page is displayed. (iOS)
Product: Forms Reporter: Jon Goldberger [MSFT] <jon.goldberger>
Component: FormsAssignee: Bugzilla <bugzilla>
Severity: normal CC: eric.maupin, jas, parmendrak, rui.marinho, seth.rosetter
Priority: Normal    
Version: 1.2.2   
Target Milestone: 1.3.3   
Hardware: Macintosh   
OS: Mac OS   
Tags: Is this bug a regression?: ---
Last known good build:
Attachments: test Project

Comment 1 Jon Goldberger [MSFT] 2014-07-25 16:42:41 UTC
From case: I am trying to create a login page with Xamarin.Forms where the page's title is "Sign In" and the next page's back button reads "Sign Out"

I tried this in LoginPage.cs
protected override void OnAppearing ()
base.OnAppearing (); 
this.Title = "Sign in"; 
UpdateChildrenLayout ();
this.ForceLayout ();

It does update the page title the first time the form loads, upon successful login this code runs:

if (loggedIn) { 
this.Title = "Sign Out";
Navigation.PushAsync (new ProjectsPage (viewModel.Context)); 

which changes the back button on the next page to "< Sign Out".

The issue is when I click that back button and go back to the login page, even though the OnAppearing() code is executed and it has ForceLayout() the title is not updated.

Is there a way to force the title to update, am I doing it The Right Way™, or is this a bug in Xamarin.Forms?
Comment 2 Jon Goldberger [MSFT] 2014-07-25 16:47:53 UTC
I was able to reproduce this issue with a test project I made. 

To repro:

1. Load the attached solution and select the iOS project as the startup.
2. Run the project.
3. Note that "Sign in" is displayed as the initial page title, which is set in the OnAppearing method for the page.
4. Press the Second Page button. Back button displays "Sign out" as the title of the LoginPage was changed on the button press before the SecondPage is pushed. 
5. Press the back button to go back to the LoginPage.

Expected Result: LoginPage will show the Title "Sign in".
Actual Result: LoginPage displays the title "Sign out". 

It seems the Title property is set as the console displayed the correct title when outputting the Title property to the console, but the title is _not_ displayed in the navigation bar. 

On Android, it works as expected.
Comment 3 Parmendra Kumar 2014-08-12 13:20:12 UTC
I have checked this issue and able to reproduce this, To reproduce this issue I have followed the steps mentioned in bug description.

Output log: https://gist.github.com/shrutis360/2eb846ef5d6b2d5bd72e

Environment info:

=== Xamarin Studio ===

Version 5.2 (build 386)
Installation UUID: 1a096c6f-0678-402e-89b2-a2c10f7e80e4
	Mono 3.6.0 ((no/f540f8a)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 306000039

=== Xamarin.Android ===

Version: 4.14.0 (Business Edition)
Android SDK: /Users/360_macmini/Desktop/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)
		3.2   (API level 13)
		4.0   (API level 14)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.2   (API level 17)
		4.3   (API level 18)
		4.4   (API level 19)
Java SDK: /usr
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

=== Apple Developer Tools ===

Xcode 5.1 (5084)
Build 5B130a

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: 606f31a
Build date: 2014-08-01 15:27:48-0400

=== Xamarin.Mac ===

Version: (Business Edition)

=== Build Information ===

Release ID: 502000386
Git revision: e6a54dee5376e6e7a2d9982695b060fddc09e65d
Build date: 2014-08-04 14:03:28-04
Xamarin addins: 2b5a5c26ac2ee74c6e91a8d24ef44d0ca9cb74d0

=== Operating System ===

Mac OS X 10.9.4
Darwin ShrutiMac.local 13.3.0 Darwin Kernel Version 13.3.0
    Tue Jun  3 21:27:35 PDT 2014
    root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64
Comment 4 Rui Marinho 2015-02-05 11:44:20 UTC
This is fixed in 1.3.2.
Comment 6 Rui Marinho 2015-02-06 09:41:36 UTC
thanks, nice catch :)
This should be fixed in 1.3.3-pre3.
Comment 7 Parmendra Kumar 2015-02-09 09:05:15 UTC
Thanks @Rui

I have checked this issue with Xamarin.Forms Now its working fine.

Hence closing this issue.