Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
Created attachment 13697 [details]
Test case, logs & screenshot
From this desk case:
Customer reports that UIBarButtonItem(UILabel) places UILabel outside of toolbar instead of making it a toolbar button. In my tests, I was able to reproduce this issue in the iPhone 5 iOS 9.1 simulator.
## Steps to reproduce
Build and deploy the attached sample app, it's one screen which shows the issue.
## Expected Results
The body of the app should be blank, while the toolbar should show the following buttons in order from left to right:
"prev", "next", (FlexibleSpace), "Some text", (FlexibleSpace), (UploadButton)
## Actual Results
The UILabel is displayed above the toolbar, in the body of the page, rather than inside the toolbar.
Reproduced in the iPhone 5 iOS 9.1 Simulator.
=== Xamarin Studio ===
Version 5.9.8 (build 0)
Installation UUID: 8ef63a7c-1b18-40de-a334-7f78777fcb55
Mono 4.0.5 ((detached/1d8d582)
GTK+ 2.24.23 (Raleigh theme)
Package version: 400050001
=== Apple Developer Tools ===
Xcode 7.1 (9079)
=== Xamarin.iOS ===
Version: 126.96.36.199 (Enterprise Edition)
Build date: 2015-10-27 18:59:21-0400
=== Xamarin.Android ===
Version: 188.8.131.52 (Enterprise Edition)
Android SDK: /Users/kentgreen/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
2.3 (API level 10)
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)
5.1 (API level 22)
6.0 (API level 23)
Java SDK: /usr
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)
=== Xamarin Android Player ===
Version: Unknown version
Location: /Applications/Xamarin Android Player.app
=== Xamarin.Mac ===
Version: 184.108.40.206 (Enterprise Edition)
=== Build Information ===
Release ID: 509080000
Git revision: cc5f6e5658589ca7f46210c57fad947e75f30abd
Build date: 2015-10-21 19:27:41-04
Xamarin addins: d77f191bd7d3451adf837b85b38f2b7c60004400
=== Operating System ===
Mac OS X 10.10.5
Darwin Kents-MBP 14.5.0 Darwin Kernel Version 14.5.0
Wed Jul 29 02:26:53 PDT 2015
## Additional Info
Adding sample, logs & screenshot
Creating the label with an explicit size and not disabling TranslatesAutoresizingMaskIntoConstraints makes the label show up in the toolbar:
> resultListStatusLabel = new UILabel (new CoreGraphics.CGRect (0, 0, 320, 40));
> // resultListStatusLabel.TranslatesAutoresizingMaskIntoConstraints = false;
Accepted as a temporary workaround, not accepted as a resolution.
If I want the label size to adapt to its content the only way is to set translatesAutoresizingMaskIntoConstraints to false and let the constraint solver use intrinsic size of the label. If the label has to be localized and I don't know the size the label has to be in advance this is the only right solution. Implemented with Objective C or Swift natively it works fine, just not with Mono.
Could you provide an objective-c project that reproduces this behavior working as you want?
Ok, you are right: implemented the same code in Objective-C, it works exactly as in Xamarin. And I have also found the reason why: UIBarButtonItem does not inherit from UIView, therefore constraints are not applicable to it.