Showing a UIPickerView with UIActionSheet in iOS8 not working
From the reference for UIActionSheet:
UIActionSheet is not designed to be subclassed, nor should you add views to its hierarchy. If you need to present a sheet with more customization than provided by the UIActionSheet API, you can create your own and present it modally with presentViewController:animated:completion:.
My guess is your seeing exactly why.
The reference for UIAlertController doesn't have a similar disclaimer, but looking at its interface, my guess is Apple will add it before release.
My recommendation would be to just create a small view containing your picker and buttons and show and hide it as needed. It's not that hard to do and your not pushing interfaces beyond their intended uses.
UIPickerView with UIActionSheet IOS 8 stop working
The link provided above actually refers to Apple Doc where it has removed adding subview to UIActionSheet. In your code, you are doing similar thing by adding UIPickerView into UIActionSheet. So in iOS8 onwards, even if the view is added to UIActionSheet, the view returned is actually nil while displaying.
For this purpose you can use ActionSheetPicker-3.0.
Actually, it's not UIActionSheet
anymore. But looks exactly the same, and that's why it works on iOS8.
Do let me know if this answers your query!
how to manage uipickerview in uiactionsheet
Finally i got the solution
First of all i have to set the width of the picker view as i have mentioned
CGRect pickerFrame=CGRectMake(0, 40, 0, 0);
so it can be like
CGRect pickerFrame=CGRectMake(0, 40, 320, 0);
I found one more good solution :
Just call the picker view in action sheet by clicking a text field:
self.textField.inputView = yourCustomView;
UIActionSheet not showing in iOS 8
UIActionSheet is deprecated in iOS 8.
To create and manage action sheets in iOS 8 you should use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet.
Refer this example.
iOS UIDatePicker not showing inside a UIActionSheet
According to Apple docs
Important:
UIActionSheet
is deprecated in iOS 8. (Note thatUIActionSheetDelegate
is also deprecated.) To create and manage action sheets in iOS 8 and later, instead useUIAlertController
with apreferredStyle
ofUIAlertControllerStyleActionSheet
.
or you can add datePicker as an inputView to the Textfield. (Just use UITextfield
instead of UIButton
to open the picker)
UIDatePicker *datepicker = [[UIDatePicker alloc] initWithFrame:CGRectZero];
[datepicker setDatePickerMode:UIDatePickerModeDate];
myTextField.inputView = datepicker;
UIPickerView Not Working In IOS 8
I solve this by making programmatically picker-view , problem is in my view because i create two view one is main and second is sliderview , calling picker from view for slider view ,
now my code is look like this
- (void)viewDidLoad
{
UIPickerView *myPickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 200, 320, 200)];
myPickerView.delegate = self;
myPickerView.showsSelectionIndicator = YES;
//[sliderView addSubview:_myPickerView];
txtstreet.inputView=_myPickerView;
myArray = arrwithdata;
}
and other code is same ... it's work in both os.
Related Topics
How to Check Whether Dark Mode Is Enabled in iOS/Ipados
Read a Text File Line by Line in Swift
How to Know Which Is the Default Measure System (Imperial or Metric) on iOS
Change Font of Back Navigation Bar Button
Error: Module File's Minimum Deployment Target Is iOS8.3 V8.3
Programmatically Get Path to Application Support Folder
Set Background Color of Active Tab Bar Item in Swift
Calculating Tiles to Display in a Maprect When "Over-Zoomed" Beyond the Overlay Tile Set
Create and Store PDF Document Programmatically Using Swift for iOS
How to Rotate an Uiimageview by 20 Degrees
Nsurlsession "Http Load Failed Kcfstreamerrordomainssl, -9813 ; Self Signing Certificate
How Does One Print All Wkwebview on and Offscreen Content Osx and iOS
App Crashes on Enabling Camera Access from Settings iOS 8
Avqueueplayer Playback Without Gap and Freeze
Limit Uitextfield Input to Numbers in Swift
Getting Device Id or MAC Address in iOS
Error: Uiview's Window Is Not Equal to Another View's Window