I have a UIPickerView in Cordova based application. I am seeing different appearance for the same UIPickerView in iOS 14 and iOS 15.
For iOS 14: It looks like this: (Fixed at the bottom)
For iOS 15 it looks like this (Floating)
My questions are
Is this how UIPickerView looks by default starting from i0S 15
Is there a way to make it float in the center ?
Related
I'm using a UITableView with Custom Cell. In this custom cell there are 7 UIButtons added. All Buttons are circular in size. They are added in such a manner that a horizontal row is made. To fit UI in all devices I have used Auto Layout. UI is perfect in all devices.
But when I run this in iPhone 6+ with zoomed mode, the two UIButtons crosses the iPhone 6+ bounds i.e. in goes beyond the bounds of Iphone 6+ width. But when I use Standard mode of iPhone6+, there is no such issue. I have tried with all combinations of Autolayouts but couldn't succeed.
I am setting a custom height and width to the UIPickerView with
mypicker = [[UIPickerView alloc] initWithFrame:CGRectMake(0.0, 0.0, myWidth, myHeight)];
While it works perfectly on simulator ios 10, it ignores the custom height and width on ios 8. Is there a way do this in ios 8?
I tried CGAffineTransform and it didn't work.
Many thanks in advance!
The reason this doesn't work on iOS 8 is that the ability to provide your own height was not introduced until iOS 9. In iOS 8, the picker view will resist any attempts at changing its height; there is a narrow legal range of heights, and any attempt to set the height outside that range will just fail (and to add to the misery, the legal range is undocumented).
There are only three valid heights for UIPickerView (162.0, 180.0 and 216.0).
You can use the CGAffineTransformMakeTranslation and CGAffineTransformMakeScale functions to properly fit the picker to your convenience.
For more information this link and this link may help .
Happy to help!
iOS 8.0.2 and iPhone plus when I set UIButton backgroundImage in XIB,UIButton become bigger though this button have layout with height and weight after running
UIButton in xcode:
and layout :
but running in iPhone plus iOS8.0.2:
but in other iPhone like 5s,6 this button is ok!!!
the backgroundimage like this :
i have setup (https://github.com/usamaiqbal83/TestingProject) a repo for your case, it is not happening for me you can compare your setup with mine . i checked it on simulator
or if i am not able to understand your scenario clearly, kindly setup a repo i will gladly take a look.
when I set the Image like this:
it is working .
I do not what has happen, but just it is.
any body know why it is?
its simple. in Xcode 6 I add an scrollView to to the view which covers entire screen. add constraints like this:
then add a contentView in the scrollView:
then add a sample label:
the problem is here when I run it on device with iOS 8: the scrollview width is 320
but on device with iOS 7 width is 320+16 = 336
what am I doing wrong here? why scroll won't remain 320? this cause my custom collectionView flowLayout doesn't work well in iOS 7.
as I guessed it was because of using margins which was introduced in iOS 8. but I was wondering I don't use margins when layouting view in the IB. after hours struggling, today I saw I have used margins for the container of this View controller.
removing margins fixed the problem.
so if you want to support iOS 7 and below turn off constrain to margins when adding new constraints in the interface builder
In my app there's a lot of wasted space in landscape on the iPhone 6, and to a lesser extent even on 4" screens. I'm already using iOS 8's UISplitViewController changes to support the two-pane view in landscape on the iPhone 6 Plus, but it'd be useful to see both panes on some smaller devices as well.
Conveniently Apple had a WWDC 2014 session, "Building Adaptive Apps with UIKit" which included details on exactly how to do this. You can download the sample code here, but in short: they put the UISplitViewController inside of a UIViewController subclass. The subclass uses setOverrideTraitCollection:forChildViewController: to force [UITraitCollection traitCollectionWithHorizontalSizeClass:UIUserInterfaceSizeClassRegular] on the split view when it considers the width wide enough. At the time the sample code worked well, and still does on most devices.
However after attempting to use this code in my own app, I discovered it fails horribly on the iPhone 6 Plus. You can see this yourself if you download the sample code and make two changes:
Add a storyboard, add an empty view controller to that, and set it as the "Launch Screen File". This is necessary to run the app at its native resolution on the 6 Plus.
In AAPLTraitOverrideViewController.m, change line 21 to size.width > 500.0, or anything greater than 414. This is necessary to ensure the split view only shows a single view in portrait on the 6 Plus.
Now you can run the app in the simulator. To see the problem, just do this:
Rotate the device to landscape (command-right arrow)
Rotate it immediately back to portrait (command-left arrow)
You can already see that something's not right. All of the table cells should have an arrow on the right side in portrait, but they don't. They're behaving like they're still in a split view. If you tap one of those rows, it gets worse—the detail view slides up from the bottom, and the navigation bar is gone.
I think there must be a bug in iOS 8 here that's causing the problem. But since this code was shared before the iPhone 6 Plus was announced, it also seems possible that it just needs some adjustments to make it compatible with that device. So far the only solution I've found is to change line 21 to something like if (size.width > 500.0 && size.width < 736.0) but I don't want to use code that could break again the next time Apple introduces a new screen size. Is there a better way to handle this?
Seems like you'll always want to make the horizontal size class regular (UIUserInterfaceSizeClassRegular). To do this, override traitCollectionDidChange:. In this method, if the vertical size class is compact (suggesting it's likely in landscape), override the trait collection so that the horizontal size class is regular.
UITraitCollection *compactHeight = [UITraitCollection traitCollectionWithVerticalSizeClass:UIUserInterfaceSizeClassCompact];
if ([self.traitCollection containsTraitsInCollection:compactHeight]) {
UITraitCollection *regularWidth = [UITraitCollection traitCollectionWithHorizontalSizeClass:UIUserInterfaceSizeClassRegular];
self.forcedTraitCollection = [UITraitCollection traitCollectionWithTraitsFromCollections:#[self.traitCollection, regularWidth]];
[self setOverrideTraitCollection:self.forcedTraitCollection forChildViewController:_viewController];
} else {
[self setOverrideTraitCollection:nil forChildViewController:_viewController];
}
However, if you'll want more specific behavior, you'll have to rely on canvas size for app-specific behavior.