Questions tagged [uipickerview]

The UIPickerView class implements objects, called picker views, that use a spinning-wheel or slot-machine metaphor to show one or more sets of values. Appears on iOS.

UIPickerView is part of the UIKit Framework and is available in iOS 2.0 and later. The UIPickerView class implements objects, called picker views, that use a spinning-wheel or slot-machine metaphor to show one or more sets of values.

Picker views can have multiple components, each of which can select independent values.

References:

3356 questions
42
votes
3 answers

How do you make an UIPickerView component wrap around?

I would like to show a set of consecutive numbers in a UIPickerView component but have it wrap around like the seconds component of the Clock->Timer application. The only behavior I can enable looks like the hours component of the Timer application,…
David
  • 9,635
  • 5
  • 62
  • 68
40
votes
3 answers

How to steal touches from UIScrollView?

Today on my creative time I did some quite comprehensive research on how to steal touches from a UIScrollView and send them instantly to a specific subview, while maintaining the default behavior for the rest of the scroll view. Consider having a…
Erik B
  • 40,889
  • 25
  • 119
  • 135
39
votes
5 answers

Set a default value for UIPickerView in Swift?

How do I set the starting row of the picker view in Swift? I see there is a similar question for Objective-C, but I don't understand the code.
KML
  • 2,302
  • 5
  • 26
  • 47
38
votes
9 answers

Center UIPickerView Text

So I have a uipickerview with rows that only contain the number 0-24 and it looks a bit silly since the numbers are left aligned leaving a huge gap on the right of the pickerview. Is there an easy way to center align text in a uipickerview?
Msencenb
  • 5,675
  • 11
  • 52
  • 84
37
votes
16 answers

IOS7 UIPickerView how to hide the selection indicator

How can I hide those 2 lines on the selected row?
james075
  • 1,280
  • 1
  • 12
  • 22
36
votes
13 answers

How do I get a list of countries in Swift ios?

I've already seen two similar questions to mine, but the answers for those questions do not work for me. I have an old project with a list of countries manually typed out inside a set of square brackets. I can easily use this in my pickerView but…
LondonGuy
  • 10,778
  • 11
  • 79
  • 151
36
votes
5 answers

Customize text color of UIDatePicker for iOS7 (just like Mailbox does)

I'm having the most frustrating dilemma. I've researched up and down and can clearly see that Apple does not want us tampering with iOS 7. Well, I want to tamper. And, the team at Mailbox clearly figured out how to do it and get approved. The main…
rnystrom
  • 1,906
  • 2
  • 21
  • 47
35
votes
6 answers

How to use two UIPickerViews in one view controller?

I have two UIPickerControllers in one view controller. I can get one to work, but when I add a second, my app crashes. Here is the code I use for one picker view: import UIKit class RegisterJobPosition: UIViewController, UIPickerViewDelegate { …
dom999999
  • 447
  • 1
  • 7
  • 11
35
votes
8 answers

Showing a UIPickerView with UIActionSheet in iOS8 not working

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…
35
votes
5 answers

iOS 7.1 UITapGesture not working with UIPickerView

We are using a UIPickerView to allow a user to select from a list of options. We are adding UIPickerView as a subview of a container UIView. We are then adding a UITapGestureRecognizer to the container UIView. The UITapGestureRecognizer is being…
Anupam
  • 555
  • 1
  • 5
  • 14
34
votes
12 answers

Fixed labels in the selection bar of a UIPickerView

In the clocks application, the timer screen shows a picker (probably a UIPicker in UIDatePickerModeCountDownTimer mode) with some text in the selection bar ("hours" and "mins" in this case). (edit) Note that these labels are fixed: They don't move…
squelart
  • 11,261
  • 3
  • 39
  • 43
33
votes
12 answers

UIDatePicker select Month and Year

I need a UIDatePicker for selecting Month and Year only. I checked the class reference documents. Looks like UIDatePicker is a UIView. I imagined UIPickerView may be a sub view and I can hide the component if I can grab it. But no. That was not…
Dave
  • 4,038
  • 9
  • 45
  • 57
31
votes
6 answers

How to detect changes on UIPickerView?

I want to detect changes of UIPickerView value. If UIPickerView respond to addTarget I used a code like this: -(void) valueChange:(id)sender { change = YES; } UIPickerView *questionPicker = [[UIPickerView alloc] init]; [questionPicker…
tristaf
  • 329
  • 1
  • 4
  • 6
31
votes
12 answers

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

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…
Hristo Atanasov
  • 1,236
  • 2
  • 18
  • 25
30
votes
5 answers

UIPickerView won't allow changing font name and size via delegate's `attributedTitleForRow...`

I use the following func to change the font color and font size, the color works but the font name and font size refuse to work. func pickerView(pickerView: UIPickerView, attributedTitleForRow row: Int, forComponent component: Int) ->…
jdleung
  • 1,088
  • 2
  • 10
  • 26