UIDatePicker not displaying properly in iOS 9 - ios

I am NOT using auto layouts and this is how the UIDatePicker is appearing in my app on iOS 9. The picker is looking flawless in iOS 8 but the problem is only with iOS 9. Any idea how to resolve this.. (P.S using auto layouts in not a solution at the moment for me.)

In the viewDidLoad() method, change a property of the date picker, for example the mode. Note that, You don't have to leave it changed, you can set it to anything and then change it back to what you actually want.
I am sure, this solution is helps you.

Related

iOS UIPickerView - Appearance

Is there any way to get the picker view in Xcode 6 to appear as it was in Xcode 4?
(source: timroadley.com)
(source: developpez.com)
Thank you.
As mentioned, the newer versions of iOS spot the plain-white picker view with just a focus window. To improve the aesthetics, to a look somewhat similar to the earlier versions, simply add a suitable background image to the control.

UITextField visibility false in appium test iOS

I have devoleped a simple iOS app and on test using Appium all the UIControls staus is shown as visibility false. The below image is the screenshot of the test. I set accessibility label on storyboard
The code I wrote for a simple textfield is given below.
self.txt_txt.isAccessibilityElement = YES;
self.txt_txt.accessibilityElementsHidden=NO;
I have done a little R&D on this and haven't found anything keep 'visibility ' true for UIControls.How to keep visibility true in the above case.If not in code are there any other scripts to run?. Any thoughts are welcome.
I believe this is a bug when using iOS8, based on the information shown in the Appium bug database here:
https://github.com/appium/appium/issues/4131
Looking at the last comment to this bug, it seems that in iOS7 elements are correctly identified as "visible: true", but the same ones in iOS8 are not.
As far as I understand it, at the moment it's not yet clear if this is a bug in Appium or in iOS8.

UIPopoverController wrong UITextField height in iOS 8

In my app I use a UIPopoverController with an embedded UINaviagtionController to show a single line UITextField to enter a number. This kind of input was working up to iOS 7.1. Since iOS 8.0 the size of the UITextField is wrong. I tried out to change the AutoresizingMask, Frame, EdgesForExtendedLayout, ... but nothing is working.
As you can see in the screenshots bellow, there is a strange behaviour.
A sample project for Xamarin.iOS is available: http://www.danflash.com/files/dev/PopoverTest.zip
I have found the issue. I had to set contentViewController.EdgesForExtendedLayout = UIRectEdge.None; within the method:
public static PopoverInputController GetPopoverController(...)
It seems that Apple did some more changes to the UI regarding the layout stuff as expected.

invert UIDatePicker colors in iOS 7

I want to start by saying that i would post this question on the Apple Dev Forums but because of the hacking attempt fiasco , or whatever that was, the forum has been offline for almost 2 weeks now and i need a solution for this as soon as possible.
In iOS 7 the UIDatePicker looks like this :
and a client asked to look like this :
(basically inverted).
I've tried a few things:
Setting the background to black and looping through all the view's subviews until i reach the labels that show the date itself and change their color to white. The problem is that The view has only one subview, and that subview doesn't have any subviews of it's own. So this solution doesn't work. (it did in ios6).
Applying a filter to the view's CALayer. The thing is that this is only possible on OS X not on iOS, for some unknown reason.
Playing with UIApperance protocol. From what i've read this should work but what i've tried didn't and i don't have extensive experience with this to figure out why not.
Any ideas what i can try? Is this even possible? Did i made a mistake in my approach of the problem?
Try this out :
Put this code in -(void)viewDidLoad
[datePicker setValue:[UIColor whiteColor] forKey:#"textColor"];
Swift:
datePicker.setValue(UIColor.white, forKey: "textColor")
Don't know if this is still relevant but on Swift 3 / Xcode 8 you can simply do this:
let datePicker = UIDatePicker()
datePicker.datePickerMode = UIDatePickerMode.date
// Sets the text color
datePicker.setValue(UIColor.white, forKey: "textColor")
// Sets the bg color
datePicker.backgroundColor = UIColor.black.withAlphaComponent(0.6)
textField.inputView = datePicker
I spent quite a bit of time struggling with the same problem. At first, I've put a UIDatePicker on a black background and was wondering why it is invisible...
I ended up placing a white UIView as a background for the date picker, so while the whole view is black, the date picker is white. It actually looks okay, although thankfully I don't have a client who would dictate the design.
One possible argument for a client: the old, pre-iOS7 date picker, also had a predefined non-customisable background.
What you want is possible, but it will be called Custom Date Picker.
Below is the link where you will find what you wanted.
https://www.cocoacontrols.com/controls/simpledatepicker
If you need more, take a loot at below link.
https://www.cocoacontrols.com/search?utf8=%E2%9C%93&q=datepicker
Well I understand your frustration, but iOS7 is under NDA. Usually this kind of views are made using layers, beacuse of sublayerTransform that can make perspective giving the idea of 3D. I would check sublayers if you don't see subviews.
The other poin is that I would not hack too much views/layers hierachy, ios<=6 to ios7 transition shown that hacking isn't a good idea.
UIAppereance protocol is probably the way to go, becauase it makes you change what you can change (without screwing that in the future), maybe you can set a backgroundImage, try to set a 1x1pixel of a blck color png, you should also see an attributed string property, or text property.
I dont think its possible to do that directly by changing the properties of the default UIDatePicker , although you can use custom controls to do it.
This might help,
MWDatePicker - https://github.com/mwermuth/MWDatePicker (Found it in cocoa controls -https://www.cocoacontrols.com/controls/mwdatepicker)
according to the iOS Design Resources:
You cannot customize the appearance of date pickers.
I would suggest one of the below:
Redesign your UI to use the black text
Use a customer datepicker
You should tell your client that his suggestion is against the design principles of iOS 7, which indeed it is. I am not a great fan of iOS 7 myself, but we should all give it a go. Your client should accept the standard iOS 7 UI provisionally, until he is in a position to make an informed judgement. Designing an app based on his initial impressions is a recipe for disaster.

iOS 6 iAd property and methods deprecated

Since iOS 6 release, there are some iAd properties and methods that are deprecated like :
currentContentSizeIdentifier
requiredContentSizeIdentifiers
ADBannerContentSizeIdentifierPortrait
ADBannerContentSizeIdentifierLandscape
So what's the best way to implement iAd now on both orientation ? Should we now resize the banner view frame manually ?
I have my application only support Landscape mode(should work for Portrait mode also), and have iAd showing up on the top of the application. And to make this work with ios6 I had to do this:
In Monotouch
storesAdBannerView = new ADBannerView();
storesAdBannerView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
For objc (which I dont use), I think it might be
[storesAdBannerView setAutoresizingMask:UIViewAutoresizingFlexibleWidth]
It seems that landscape ads are somewhat phased out.
See: http://www.iphonedevsdk.com/forum/iphone-sdk-development/108118-landscape-iad-banners-in-ios-6-edit-landscape-phased-out-completely.html
It need further confirmation, as I could not find any Apple document regarding that change.
I sAw 2 workaround there : http://www.touch-code-magazine.com/iad-code-is-broken-in-ios6/ Tested the first solution:
easy temporary solution – you can quickly get your app to compile again by using a cheap cheat, add explicitly #import to the files where you are accessing currentContentSizeIdentifier and the size name constants. That should get you going until you alter your app to use the new auto-layout features.
It works ok on xcode 4.5 (banner test ok).

Resources