Bug 23832 - [iOS only] Changing the Icon for pages in TabbedPages does not update TabBarItem.SelectedImage
Summary: [iOS only] Changing the Icon for pages in TabbedPages does not update TabBarI...
Status: VERIFIED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.2.3
Hardware: PC All
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL: https://github.com/xamarin/Duplo/issu...
Depends on:
Blocks:
 
Reported: 2014-10-15 01:41 UTC by Brendan Zagaeski (Xamarin Team, assistant)
Modified: 2015-01-19 12:40 UTC (History)
4 users (show)

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


Attachments
Test case (87.97 KB, application/zip)
2014-10-15 01:41 UTC, Brendan Zagaeski (Xamarin Team, assistant)
Details


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:
Status:
VERIFIED FIXED

Description Brendan Zagaeski (Xamarin Team, assistant) 2014-10-15 01:41:59 UTC
Created attachment 8421 [details]
Test case

[iOS only] Changing the Icon for pages in TabbedPages does not update TabBarItem.SelectedImage

Since TabbedPages do not display icons on Android or Windows Phone, this bug only applies to iOS.


## Steps to reproduce

1. Run the attached test case on an iOS device or simulator.

2. Tap the "Change icon" button.
This simply sets `Icon = "second.png"` on the first tab's ContentPage.


## Actual result

The icon for the first tab does not change to a square in the selected state, but if you tap the second tab icon, you can see that the icon in the un-selected state has changed to a square ("second.png").


## Expected result

The icon for the first tab changes to a square in both the selected and un-selected state.


## Additional information

It looks like what's happening is that the `Xamarin.Forms.Platform.iOS.TabbedRenderer` only sets `TabBarItem.Image = image` when the `Tabbed.PagesChanged` event fires. This will only change the image for the un-selected state. To change the image in the selected state as well, the `TabbedRenderer` can also set `TabBarItem.SelectedImage = image`.

As one small reassurance, this behavior is indeed the same in Objective-C Xcode apps. I confirmed that the following line only changes the image for the un-selected state:
> self.tabBarItem.image = [UIImage imageNamed:@"second"];


## Version information

Tested on iOS 8.0 simulator and iPhone 4s, iOS 7.1.2 device.

Xamarin.Forms 1.2.3.6257

Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Version 4.5.51641

Xamarin   3.7.203.0 (ff146f5240189a2ec6d3c6f75cf3967f79c79a18)
Xamarin.Android   4.18.0.34 (3b7ef0a796e8744972c48034403a6e7cb7ec189e)
Xamarin.iOS   8.2.0.0 (65b2f3a0f52f365b90ac952f0ec2e40fa0b510d4)


### Mac build host

Xcode 6.0.1 (6528), Build 6A317

Xamarin.iOS 8.2.0.193 (Business Edition)
Hash: 959c1e4
Build date: 2014-10-03 00:25:37-0400

Mac OS X 10.9.5
Comment 2 Udham Singh 2014-10-15 05:04:15 UTC
I have checked this issue with sample project attached in bug description and observed the same behaviour mentioned in bug.

Screencast : http://www.screencast.com/t/XvPaBLGQ7U

Environment Info : 

Xamarin.Forms : 1.2.3.6257

=== Xamarin Studio ===

Version 5.5 (build 227)
Installation UUID: ce927b2a-2c07-44c5-b186-09cfdafba6dc
Runtime:
	Mono 3.10.0 ((detached/47db868)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 310000019

=== Apple Developer Tools ===

Xcode 6.0.1 (6528)
Build 6A317

=== Xamarin.iOS ===

Version: 8.2.0.193 (Business Edition)
Hash: 959c1e4
Branch: 
Build date: 2014-10-03 00:25:37-0400

=== Xamarin.Mac ===

Version: 1.10.0.13 (Business Edition)

=== Xamarin.Android ===

Version: 4.18.0 (Business Edition)
Android SDK: /Users/xamarin76/Desktop/android-sdk-macosx
	Supported Android versions:
		1.6    (API level 4)
		2.1    (API level 7)
		2.2    (API level 8)
		2.3    (API level 10)
		3.0    (API level 11)
		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)
		4.4.87 (API level 20)
		4.5    (API level 21)
Java SDK: /usr
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Build Information ===

Release ID: 505000227
Git revision: 7b721eeec7a2fa4c4f4de0ecd2aed4dc25edac95
Build date: 2014-10-02 15:53:38-04
Xamarin addins: 99ed56b428b31eba1efaace4d82188d6f334e6ca

=== Operating System ===

Mac OS X 10.9.4
Darwin Xamarin76s-Mac-mini.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 3 Jason Smith [MSFT] 2015-01-18 04:08:14 UTC
Should be fixed in 1.3.0
Comment 4 Udham Singh 2015-01-19 12:40:41 UTC
I have checked this issue with below builds and now this is working fine.

Screencast : http://www.screencast.com/t/Lh5TinDP7

Hence closing this issue. 

Environment Info :

Xamarin.Forms : 1.3.1.6296

=== Xamarin Studio ===

Version 5.7.1 (build 13)
Installation UUID: ce927b2a-2c07-44c5-b186-09cfdafba6dc
Runtime:
	Mono 3.12.0 ((detached/a813491)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312000068

=== Apple Developer Tools ===

Xcode 6.1.1 (6611)
Build 6A2008a

=== Xamarin.iOS ===

Version: 8.6.1.9 (Enterprise Edition)
Hash: d8e6436
Branch: 
Build date: 2015-01-18 17:38:20-0500

=== Xamarin.Android ===

Version: 4.20.0.28 (Enterprise Edition)
Android SDK: /Users/xamarin76/Desktop/android-sdk-macosx
	Supported Android versions:
		1.6    (API level 4)
		2.1    (API level 7)
		2.2    (API level 8)
		2.3    (API level 10)
		3.1    (API level 12)
		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)
		4.4.87 (API level 20)
		5.0    (API level 21)
Java SDK: /usr
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Xamarin.Mac ===

Version: 1.10.0.18 (Enterprise Edition)

=== Build Information ===

Release ID: 507010013
Git revision: 8e357d6be321e716f361ebc9591e4cee7f217c21
Build date: 2015-01-15 14:23:22-05
Xamarin addins: a6842a7727f64e956f942b8160f7835c9d9076a4

=== Operating System ===

Mac OS X 10.9.5
Darwin Xamarin76s-Mac-mini.local 13.4.0 Darwin Kernel Version 13.4.0
    Sun Aug 17 19:50:11 PDT 2014
    root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64