uipickerview

UIPickerView: Get row value while spinning?

喜欢而已 提交于 2019-12-17 20:45:36
问题 I'd like to get the row value in real-time as the iPhone user spins a wheel in a UIPickerView (not just when the wheel settles onto a particular row). I looked into subclassing UIPickerView then overriding the mouseDown method, but I couldn't get this to work. Any suggestions would be very much appreciated. 回答1: Perhaps try implementing the delegate method: - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view

Reusing view in UIPickerView with iOS 7

只谈情不闲聊 提交于 2019-12-17 20:43:56
问题 EDIT 12-14-2015 : This problem is again frequently reported on iOS 7, iOS 8, iOS 9.... I think Apple want not of this control anymore, and should just forbid us to use it instead of let such a major bug I use a UIPickerView with custom views loaded from a Xib. I was using the method -(UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view from UIPickerViewDelegate to reuse my views. With iOS 6, my UIPickerview

IOS7 UIPickerView how to hide the selection indicator

◇◆丶佛笑我妖孽 提交于 2019-12-17 17:44:10
问题 How can I hide those 2 lines on the selected row? 回答1: [[pickerview.subviews objectAtIndex:1] setHidden:TRUE]; [[pickerview.subviews objectAtIndex:2] setHidden:TRUE]; Use this in titleForRow or viewForRow delegate method of the pickerView . 回答2: Based on the other answers, I decided to enumerate the subviews and saw that the lines have a height of 0.5 so my solution now looks like this in Swift: func numberOfComponentsInPickerView(pickerView: UIPickerView) -> Int { pickerView.subviews.forEach

UIPickerView: NSAttributedString not available in iOS 7?

北城以北 提交于 2019-12-17 16:47:10
问题 It seems the UIPickerView no longer supports the use of NSAttributedString for picker view items. Can anyone confirm this? I found NS_AVAILABLE_IOS(6_0) in the UIPickerView.h file, but is this the problem? Is there a way around this, or am I out of luck? - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component; - (NSAttributedString *)pickerView:(UIPickerView *)pickerView attributedTitleForRow:(NSInteger)row forComponent:(NSInteger

How to use one UIPickerView for multiple textfields in one view?

做~自己de王妃 提交于 2019-12-17 16:45:30
问题 I have 8 textfields in one view. I want to populate each using a pickerview. Can I have 1 pickerview which will display different list of items from different arrays for different textfields? Can someone explain how do I do it programmatically with a sample code? Also how can I hide the pickerview when the view loads and it should be displayed only when I click on a textfield with its corresponding data list? It should disappear when I select the data and reappear when I click on a different

Showing a UIPickerView with UIActionSheet in iOS8 not working

流过昼夜 提交于 2019-12-17 15:43:01
问题 Showing a UIPickerView with UIActionSheet in iOS8 not working The code works in iOS7 , however it is not working in iOS8 . I'm sure it is because UIActionSheet is deprecated in iOS8 and Apple recommends to use UIAlertController . However, how to do it in iOS8 ? I should use UIAlertController ? iOS7 : iOS8 : EDIT: My GitHub project solving the problem. 回答1: From the reference for UIActionSheet: UIActionSheet is not designed to be subclassed, nor should you add views to its hierarchy. If you

Is there any way to add UIPickerView into UIAlertController (Alert or ActionSheet) in Swift?

时光毁灭记忆、已成空白 提交于 2019-12-17 09:22:15
问题 I'm totally new to swift (and iOS programming at all), but I started messing around with it (it wasn't a good idea when everything is still beta version :D). So I tried to figure it out by myself, but still nothing. Even tried to add subview containing picker without any success. So can any one help me? 回答1: Well this is my final code which worked for me. It is a mix by a few ideas. The main reasons that I will accept my answer is that my code is in Swift, my code uses UIAlertController, my

Is there any way to add UIPickerView into UIAlertController (Alert or ActionSheet) in Swift?

自闭症网瘾萝莉.ら 提交于 2019-12-17 09:22:13
问题 I'm totally new to swift (and iOS programming at all), but I started messing around with it (it wasn't a good idea when everything is still beta version :D). So I tried to figure it out by myself, but still nothing. Even tried to add subview containing picker without any success. So can any one help me? 回答1: Well this is my final code which worked for me. It is a mix by a few ideas. The main reasons that I will accept my answer is that my code is in Swift, my code uses UIAlertController, my

Is there any way to add UIPickerView into UIAlertController (Alert or ActionSheet) in Swift?

南笙酒味 提交于 2019-12-17 09:22:09
问题 I'm totally new to swift (and iOS programming at all), but I started messing around with it (it wasn't a good idea when everything is still beta version :D). So I tried to figure it out by myself, but still nothing. Even tried to add subview containing picker without any success. So can any one help me? 回答1: Well this is my final code which worked for me. It is a mix by a few ideas. The main reasons that I will accept my answer is that my code is in Swift, my code uses UIAlertController, my

Change UIPickerView background

我与影子孤独终老i 提交于 2019-12-17 04:56:20
问题 I want to change the border color of a UIPickerView. I do not see a tint property for the UIPickerView. Is there any way this could be done? Or a workaround? Thanks. 回答1: If you just want a workaround, take a screen shot in the simulator, open it in photoshop, crop it to just the UIPickerView area, make the center transparent, apply whatever tint you want, add that image to your project, and add it as a UIImageView on top of the UIPickerView. 回答2: You could also mask the component. With a bit