uipickerview

UIPickerView selectRow:inComponent:animated not working in viewDidLoad but working in viewDidAppear

流过昼夜 提交于 2019-12-10 10:53:45
问题 This issue is driving me crazy. I have a UIPickerView that I loaded in viewDidLoad, and I need to initialize the selected row that is to appear on the screen. My code is as follows: self.pickerSkins.delegate = self; [self.pickerSkins reloadAllComponents]; NSLog(@"%d", [self.pickerSkins numberOfRowsInComponent:0]); [self.pickerSkins selectRow:1 inComponent:0 animated:NO]; I have put this in viewDidLoad. NSLog logs a value of 2. However, the selected row that pops up is always the first row and

How do I decrease the speed in which a row is selected in a PickerView?

一笑奈何 提交于 2019-12-10 02:58:53
问题 My goal is to create a slotmachine, in which the rows are spinning and one by one, they need to stop spinning, one by one. However, to make it look nice, the rows needs to spin atleast like 3 seconds. I think PickerView is the best option for this, since I have no idea on how to make this work in a different way. When this is my code: self.slotMachine.selectRow(99, inComponent: 1, animated: true) The PickerView will go to row 99, but in 1 second. How can I control this second (and extend the

How to set the background color of UIPickerView on iOS 7 using SDK 7?

前提是你 提交于 2019-12-09 14:18:23
问题 How to set the background color of UIPickerView on iOS 7 using SDK 7 and use a standard picker on iOS 5 and 6 ? It's transparent by default on iOS 7. 回答1: What's wrong with: [picker setBackgroundColor:[UIColor whiteColor]]; I'm assuming you have a reference to the picker view if you're invoking it, and it's a subclass of UIView so backgroundColor is a valid property... 回答2: I wanted to write it as a comment, but it would be hard to read :) Sooo.... -(UIView *)pickerView:(UIPickerView *

UIPickerView infinite rows

橙三吉。 提交于 2019-12-09 13:03:09
问题 As seen in UIDatePicker you can scroll up endlessly (as well as down for that matter). I want to accomplish that too, because I want people to select a date such as: 1 January, 2010 2 January, 2010 ... 30 December, 2010 31 December, 2010 1 January, 2011 .. So it can go on forever. How would I accomplish this? Since I can only give a specific amount of rows in the delegate. 回答1: I don't think you can actually make the UIPickerView loop, but the way I've done it in the past is to return a

How to show keyboard after used inputView

╄→尐↘猪︶ㄣ 提交于 2019-12-09 10:50:02
问题 I used inputView to show uipickerview for my textfield , but I use same textfield for other functions. How can I show standard keyboard after I used inputView for that textfield ? textfield.inputView = pickrView; 回答1: Just textfield.inputView = nil; worked for me 回答2: As Pavel Kaljunen said, you need only to set the inputView to nil, but when the keyboard is already visible, you have to resignFirstResponder first, set the inputView to nil and then becomeFirstResponder again. [UIView

Picker View not appearing on 1st attempt of button click

被刻印的时光 ゝ 提交于 2019-12-08 21:59:26
I have a button on the extreme right of the cell. Now I have a picker view which needs to be displayed on button click. Its working fine with the following code: -(IBAction)buttonPressed:(id)sender { [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.3]; CGAffineTransform transform = CGAffineTransformMakeTranslation(0, 200); monthPicker.transform = transform; [self.view addSubview:monthPicker]; [UIView commitAnimations]; } But I searched for making picker view hide when it is visible and be shown when no picker view is present,I found out a solution for it.....added the

Core Data - Getting Unique Rows

好久不见. 提交于 2019-12-08 21:56:25
I'm working on an iPhone app that uses Core Data. I have only one entity called Books, and that entity has the attributes Title, Author, ISBN, Description and Shelf. I'm working on the book editing view, and want to have a UIPickerView listing all of the unique Shelf rows so that the user can just pick a shelf. My question is -- how do I get an NSArray of all of the unique Shelf attributes across all of the books in the database? I have access to the managedObjectContext of the Book being edited, so would I use some sort of a fetch request? Thanks! You can get a duplicate-less array of

How do I support VoiceOver in UIPickerView on an iPad running an iPhone only app (non-universal)?

时光毁灭记忆、已成空白 提交于 2019-12-08 18:43:33
问题 Generally I look at Apple's UICatalog sample code for basic VoiceOver support however it looks like there is VoiceOver support for UIPickerViews in the sample code. Do I need to provide an accessibilityLabel method somewhere to add VoiceOver support? I tried to implement UIPickerViewAccessibilityDelegate methods but voice over only reads the labels in my picker view and not the hint to swipe up or down to change the values. Also my picker view is set to the input view of a UITextField. So I'm

Allowing user to select a UIPickerView row by tapping

寵の児 提交于 2019-12-08 15:24:33
问题 I'm trying to use a UIPicker View with a behavior somehow different of what's usually seen in iPhone code examples. What I want to do is to allow users to scroll through the picker contents, but not to select a picker's row automatically (using the "didSelectRow" method from picker's delegate). Instead, I want to allow the user to touch the center row of the picker, which gets highlighted, and becomes the selection. Is there any way to achieve this? Thanks in advance. 回答1: Add a gesture

Picker View not appearing on 1st attempt of button click

夙愿已清 提交于 2019-12-08 09:56:21
问题 I have a button on the extreme right of the cell. Now I have a picker view which needs to be displayed on button click. Its working fine with the following code: -(IBAction)buttonPressed:(id)sender { [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.3]; CGAffineTransform transform = CGAffineTransformMakeTranslation(0, 200); monthPicker.transform = transform; [self.view addSubview:monthPicker]; [UIView commitAnimations]; } But I searched for making picker view hide when