Xcode 5 — wrong interface on a device with iOS7 - interface-builder

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.

Related

Change iOS status bar text color while dark mode is activated

With iOS 13 new dark mode feature, it now seems impossible for me to control the status bar text color in Xamarin Forms. Most of the solutions I find seem to be from before dark mode was introduced to iOS.
My application uses resources so that I can easily change the style of the whole app. Even in dark mode, the color of my navigation bar is not pleasant to read with white text. I need to set the color of the status bar to black, no matter what color mode the device has activated.
I've tried to set the colors manually in my navigation page, but it seems to be overriden by iOS color mode. This code works on Android:
BarTextColor = Color.Black;
BarBackgroundColor = (Color)App.Instance.Resources["PrimaryColor"];
I've tried setting true and false to UIViewControllerBasedStatusBarAppearance.
I've also tried all settings of Status Bar Style in Info.plist.
Does anyone know of a way to control this in Xamarin Forms since the release of Dark Mode?
Did you check this docs? NavigationPage Bar Translucency on iOS NavigationPage Bar Text Color Mode on iOS . Maybe translucency can solve your problem?
The problem was fixed by switching to Xamarin iOS SDK 13, it adds an item to the StatusBarStyle enumeration.
More info here.

UITabBar displays UITabBarItem image ignoring rendering mode AlwaysOriginal

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)
}

How to incorporate a UISearchController into new (iOS8) UISplitviewController

I try to build a simple app based on the UISplitViewController template from Xcode 6 for universal apps (with Storyboard and CoreData/NSFetchedResultsController). This app should also provide a search bar for the MasterViewController. Unfortunately, Xcode 6 provides no InterfaceBuilder element for the UISearchBar/UISearchController combo (only the depreciated UISearchBar/UISearchDisplayController).
In the iOS Developer library, Apple provides the "Table Search with UISearchController" example, but this is not based on the UISplitViewController and supports only iPhone.
My problem is, that I'm not able to show the detail view on the correct ViewController under all circumstances. I tried to transfer the approach from the Apple example project to the UISplitViewController template. In this, one is encouraged to show the search results in a separate UITableViewController subclass (ResultsTableViewController) and use this as the searchResultsController of the UISearchController. I was not able to create a scene in InterfaceBuilder for this setup so I had to add these manually in code.
The problems begin when I click on a table cell of the ResultsTableViewController. This vc is not part of the scene in InterfaceBuilde and I don't know how to add it to the SplitViewController setting correctly. The biggest problem is the weird behavoir of the iPhone 6 Plus and the UISplitViewController. In portrait mode it behaves like an iPhone and doesn't seem to have a SplitViewController and only uses a NavigationController to which I push my DetailViewController. In landscape mode it behaves like an iPad with SplitViewController were I have to get the second ViewController of the SplitViewController childControllers and push the DetailViewController on this one.
Now it happens, when I start in portrait mode and switch to landscape mode that the DetailViewController is all gone, showing gray space where the DetailVC should be. It seems, when going to portrait mode, the DetailViewController gets kicked from the SplitViewController (or the SplitViewController gets kicked at all in favor for the iPhones NavigationController setup). When switching back to landscape the SplitViewController is initialized again but without proper initialization of the DetailViewController.
Is there any template or suggestion on how to correctly implement search capabilities on a universal UISplitViewController?
Cheers
Björn

How Do I Run Full-Screen Across Multiple Screens in OSX

I am making a Cocoa application that presents a slide show of videos and images. If there are multiple screens connected (to a Mac Mini for example) I want different content to be shown on each screen. Each NSWindow should be full screen on each NSScreen.
When developing this on OSX 10.8 I set each NSWindow frame to a NSScreen frame with NSBorderlessWindowMask. I did not explicitly use NSApplicationPresentationFullScreen on NSApplication, I used NSApplicationPresentationHideDock and NSApplicationPresentationAutoHideMenuBar.
There seem to be some problems with this approach. Some OSX events seem to force the Menu Bar into view and permanently shift the windows down.
Is there a better approach to this now that OSX Mavericks has updated full screen support? Can I open an NSApplication in true fullscreen mode and force a separate NSWindow to each NSScreen?
Thank you.
You could instantiate one NSWindow per screen and switch them to fullscreen:
[self.windowA setFrame:[[[NSScreen screens] firstObject] visibleFrame] display:NO];
[self.windowB setFrame:[[[NSScreen screens] lastObject] visibleFrame] display:NO];
[self.windowA toggleFullScreen:nil];
[self.windowB toggleFullScreen:nil];

image position iOS 7 vs iOS 6

I have a background image issue for my app after I updated the project for iOS 7.
The app is navigation controller managed. I have a background image (UIImageView) created in IB. Since I place it a bit under the navigation menu I assume that the placement is calculated from the top of the view which in iOS 7 is beneath the Navigation Controller. When I run the app in iOS 6 the image is quite far down on the screen. Once again I assume this is because the top of the view in iOS 6 is below the Navigation Controller menu.
How do I fix so that the image has the same vertical distance from the navigation controller in iOS7 and iOS6?
Best regards
Frederik
iOS 7 brings several changes to how you lay out and customize the appearance of your UI. The changes in view-controller layout, tint color, and font affect all the UIKit objects in your app. In addition, enhancements to gesture recognizer APIs give you finer grained control over gesture interactions.
Please refer answer here.
One solution what I did is : I hooked background image to a reference from my xib, and set the frame programmatically from ViewDidLoad. It works fine.Please note that not forget to check iPhone 5 and iPhone 4 and set height to 568 and 480 respectively.

Resources