uipickerview

How do I add multiple components to a PickerView?

无人久伴 提交于 2019-12-01 01:17:49
It may be a simple question but how do I add multiple components to a UIPickerView? I use NSMutableArray to populate one component but I dont know how to populate the others. I also need to change the value of a label when a row is selected. Thanks in advance Kieran Tiquelou I take it that you are a beginner. Here's how to implement the methods nacho has rightly pointed out: - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView { // return the number of components required return 2; } You can use other NSMutableArray 's to populate the components. Assuming that you have 2

How do I get the frame width of UIAlertController?

僤鯓⒐⒋嵵緔 提交于 2019-11-30 21:48:05
I'd like to get the width of UIAlertController frame so that I can specify the width of UIPickerView and UIToolbar which will come with the UIAlertController. I've tried to use the following statement to get the width. alertPicker.view.frame.size.width But, the width is as same as viewController's: self.view.frame.size.width Any idea to get the width of the UIAlertController? Thanks a lot. This is my code. UIAlertController *alertPicker = [UIAlertController alertControllerWithTitle:nil message:@"\n\n\n\n\n\n\n\n\n\n\n\n" preferredStyle:UIAlertControllerStyleActionSheet]; CGRect pickerFrame =

how to add UIPickerView in UIActionSheet

牧云@^-^@ 提交于 2019-11-30 21:02:09
i'm having task to enter rating(1 - 5) value, so i found the below code for date picker, can anyone help me to alter below code so to add UIPickerView to choose rate from 1 to 5 UIActionSheet *menu = [[UIActionSheet alloc] initWithTitle:@"Ratings" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:nil]; UIDatePicker *pickerView = [[UIDatePicker alloc] init]; pickerView.datePickerMode = UIDatePickerModeDate; [menu addSubview:pickerView]; [menu showInView:self.view]; [menu sendSubviewToBack:pickerView]; [menu setBounds:CGRectMake(0,0,320, 500)]; CGRect

Invalid context error on iOS 7 when adding a UIPickerView inside a UIActionSheet?

泄露秘密 提交于 2019-11-30 19:05:36
I have an UIPickerView inside an UIActionSheet and have done that in a way suggested by many others here at SO: Add UIPickerView & a Button in Action sheet - How? how to add UIPickerView in UIActionSheet The solutions have worked fine until now when testing my app on iOS 7. It still works but I got a lot of "invalid context 0x0" warnings during runtime in Xcode. The errors are coming with a nice message too: CGContextSetFillColorWithColor: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall

Does UIPickerView's selectRow:inComponent:animated: call pickerView:didSelectRow:inComponent:?

帅比萌擦擦* 提交于 2019-11-30 17:42:56
Does UIPickerView's selectRow:inComponent:animated: call pickerView:didSelectRow:inComponent: ? Otherwise, can I just call it myself? Thanks You do have to call it manually and you do it though the delegate. // In this example the UIPickerView object is in a property ... self.pickerView.datasource = self; self.pickerView.delegate = self; // Selects the row in the specified component [self.pickerView selectRow:0 inComponent:0 animated:NO]; // Manually calls pickerView:didSelectRow:inComponent: [self pickerView:self.pickerView didSelectRow:0 inComponent:0]; It does not, although it is possible

How do I change the font size in a UIPickerView in Swift 3?

笑着哭i 提交于 2019-11-30 17:37:26
How do I change the font size in a picker view? I have read a lot of questions about this, but none are in Swift 3. I have three picker views; the first two have two columns and have the same data source and delegate. The last one has one column and has a different data source and delegate. I can't fit the text in the first two picker views by one character. How do I shrink the font size in a UIPickerView and adjust the picker view row height, if necessary? Thanks. class ViewController: UIViewController { //MARK: Properties @IBOutlet weak var layoutLengthPicker: UIPickerView! @IBOutlet weak

How do I get the frame width of UIAlertController?

对着背影说爱祢 提交于 2019-11-30 17:11:26
问题 I'd like to get the width of UIAlertController frame so that I can specify the width of UIPickerView and UIToolbar which will come with the UIAlertController. I've tried to use the following statement to get the width. alertPicker.view.frame.size.width But, the width is as same as viewController's: self.view.frame.size.width Any idea to get the width of the UIAlertController? Thanks a lot. This is my code. UIAlertController *alertPicker = [UIAlertController alertControllerWithTitle:nil

How do I setup a second component with a UIPickerView

╄→尐↘猪︶ㄣ 提交于 2019-11-30 15:35:42
问题 I've found some similar questions to this but none of the solutions matched my situation, and most were in objective-c which I don't know. I'm trying to create a timer with minutes and seconds but I can't figure out how to wire up my second component. How do I set up a second component with a UIPickerView? This is what I have so far: TimeViewController.swift class TimeViewController: UIViewController, UIPickerViewDelegate { @IBOutlet weak var timeSegueLabel: UILabel! let minutes = Array(0...9

Dependent UIPickerView

吃可爱长大的小学妹 提交于 2019-11-30 15:20:50
Does any one know how to make dependent UIPickerView. For example when i select row 2 of component one the titles for component two change? I have looked on the internet there is no real answer, i have tried using if and switch statements but they just crash. It depends on how you are going to keep data. For an example if you have an array as the value of a key of a dictionary, and that dictionary have different such keys, the first column will be the keys, and on selecting one you will be displaying the array in the other column (component). - (NSInteger)numberOfComponentsInPickerView:

Does Android provide widget like the iPhone UIPickerView

冷暖自知 提交于 2019-11-30 15:07:43
问题 I feeling that the UIPickerView of iPhone is good idea and easy to use on touchable mobile phone. I am strange that why Android SDK do not provide the same effect widget ? or maybe coder have to clone it on Android ? any help ... thanks ... 回答1: FWIW, I was looking for the same thing, and I found this -> http://code.google.com/p/android-wheel. I have not used it yet, but I am thinking about giving it a whirl. 回答2: I think the spinner would be the android equivalent. It doesn't have the same