With the release of tvOS 9.1 and Xcode 7.2, my UITabBarItem images are being displayed incorrectly. In my view controllers, I set the tabBarItem.image and tabBarItem.selectedImage with images using UIImageRenderingMode.AlwaysOriginal.
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.tabBarItem.image = UIImage(named: "myTabImage")?.imageWithRenderingMode(.AlwaysOriginal)
self.tabBarItem.selectedImage = UIImage(named: "myTabImageSelected")?.imageWithRenderingMode(.AlwaysOriginal)
}
The selected image displays correctly, but the non-selected image displays as a template, that is, its color information is ignored.
Both images displayed correctly using the tvOS 9.0 SDK, but the non-selected image is displaying incorrectly in tvOS 9.1. To make matters worse, the non-selected images are being shown as black and the tab bar background is also black.
Here is the same code running on tvOS 9.0
I suspect this is a bug with tvOS 9.1, but has anyone found a workaround or see something that I am not doing correctly?
We have seen something similar in our tvos app, except we use text instead of images. tvOS 9.1 ignoring textColor.
UITabBarItem.appearance().setTitleTextAttributes([
NSForegroundColorAttributeName: <barTextColor>
], forState: UIControlState.Normal)
UITabBarItem.appearance().setTitleTextAttributes([
NSForegroundColorAttributeName: <barTextColorSelected>,
], forState: UIControlState.Selected)
It appears to definitely be a bug in the UITabBarController implementation for tvOS 9.1. So I ended up writing my own replacement. While at it, I added support for more than 7 tab bar items, made it look nice on a black background, and included a search bar on one of the tabs (also on a black background). This solves many of the difficulties I faced trying to build my first tvOS app.
Link to Github repository
This is was confirmed as a bug by Apple and has been fixed in tvOS 9.1.1.
It may be help to tvOS 9.1. This code write into the viewDidLoad() of UITabBarController.
for item in self.tabBar.items!{
item.setTitleTextAttributes([NSForegroundColorAttributeName:UIColor.blackColor()], forState: UIControlState.Normal)
item.setTitleTextAttributes([NSForegroundColorAttributeName:UIColor.greenColor()], forState: UIControlState.Focused)
}
Related
I am working for a company that brand guideline requesting title view having black (#000) as background color. I am using Xamarin.Forms 4.0 Shell to build the app. Android is working great but iOS is "not that black".
To demonstrate the problem, I am using official example "Xaminals" as trial and changing the title color to "Black". Please see the resulting image below.
iOS Screenshot
Android Screenshot
Please see if there are anything wrong with my code in order to achieve "Real Black" (#000) for iOS title view background color. Thanks in advance!
Sample for reference.
The title view is placed on the Navigation bar. And the default setting(translucent) for navigation bar on iOS is true. So it looks like not really black.
If you don't want this effect you can disable it on iOS project:
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
Xamarin.Forms.Forms.SetFlags("CollectionView_Experimental");
global::Xamarin.Forms.Forms.Init();
LoadApplication(new App());
UINavigationBar.Appearance.Translucent = false;
return base.FinishedLaunching(app, options);
}
I've got a strange (and very annoying) bug while trying to horizontally centering some text within a UITextField.
I have placed a UITextField using Storyboard with plain-text (not attributed) setting the horizontal alignment to center. Text appears correct aligned (centered) in storyboard but gives different results for different versions of iOS and between simulator and real device:
Simulator iPad with iOS 7.0:
non-editing mode: centered
editing mode: centered
after leaving editing mode: centered
Simulator iPad with iOS 7.1:
non-editing mode: left aligned
editing mode: centered
after editing mode: centered
iPad Air with iOS 7.1:
non-editing mode: left aligned
editing mode: centered
after editing mode: left aligned
Setting the NSTextAlignmentCenter before or after setText has no effect.
Is this a bug in iOS 7.1? Does anyone got the same problem or even a solution for that?
I had the similar problem in iOS8. Look like an iOS bug to do with making the text selectable.
If you make the text selectable in the Storyboard, it all works OK.
If its NOT selectable in the Storyboard, it always left justifies.
My UITextView is in a table cell, and I found I can setSelectable:NO in cellForRowAtIndexPath and it still aligns correctly (centred in my case) with selectable on in the Storyboard.
Tested in simulator (iOS 7.1 and 8.1) and on device (iOS 8.1).
I had the same bug and this is my fix. For the UITextView, set its text alignment in code and call its method layoutIfNeeded(). I did that after setting the text, if that makes a difference to anyone.
I tested it on simulator for iOS 8.4 and Xcode 6.4. Hope it helps!
When I open old xcode projects or add a new UITextView in Xcode 5, UITextViews are appearing empty.
It is appearing only editing. Can I see preview?
You can give shadow or background color to textView which makes it visible.
Otherwise you can add lines to the textView.
For lines you can refer this link.
My setting for the project:
Deployment target: iOS6.1
Base SDK: 7.0
IB Document: Opens in 5.0
When I run app in simulator(7.0) I see almost what I expect (I don't understand why barbuttons don't use color tint — on previous screen it shows blue):
But if app is running on a device (also 7.0),
Then I see:
As you can see this is some kind of iOS6 UI, but tableview goes under the navbar, which became transparent.
Why does it happen?
Behavior of tintColor for bars has changed on iOS 7.0, please check the image below:
So now to change the tint color for your bar buttons you need to use tintColor which is the color for the interactive elements within a navigation bar including button images and titles.
While barTintColor is the background color of the UINavigationBar.
So basically
For buttons and title:
[[UINavigationBar appearance] setTintColor:[UIColor grayColor]];
For bar tint:
[[UINavigationBar appearance] setBarTintColor:[UIColor lightGrayColor]];
For the tableVIew under the navBar part, set navigationBar.translucent = NO;
I enabled Autolayout in IB, and now it uses iOS7 on a device too.
Upd.: After some time it start show strange design again. It gone only after I set iOS7 as base and deployment SDK.
I'm trying to update an IOS app for IOS6 and iPhone 5, but I have a problem resizing some views from the main Storyboard.
When I click on the new "Apply Retina 4 Form Factor" button, some of the views included in the StoryBoard don´t resize. I´ve checked all the settings for every Scene and seem to be configured in the same way. Any idea? Thanks in advance.
You might have found your solution but I just had a similar problem. For future notice, I found the fix was in the show size inspector and instead of using layout rectangle, I used frame rectangle.
I was having the same problem, this answer worked for me and finally removed the letterbox:
https://stackoverflow.com/a/12927282/539149
So add a 640x1136 launch image called Default-568h#2x.png and set the "Retina (4-inch)" target setting to it. More info for the other sizes here:
http://www.idev101.com/code/User_Interface/launchImages.html
Just in case it helps others, I had tried these links and none of them got rid of the letterbox, but they did at least enable the resize masks:
Resize of UIViewController in storyboard
Xcode 4.5: can't set root view autoresizingMask in Interface Builder
how do you resize (visually, not programmatically) the detail view of a UISplitViewController in a storyboard?
iphone 5 and storyboard setting autoresizing masks