Questions tagged [uipickerviewdatasource]

UIPickerViewDataSource is an iOS protocol for defining methods instructing a UIPickerView how many components and rows it should display.

UIPickerViewDataSource is an iOS protocol defining methods instructing a UIPickerView how many components and rows it should display. A picker view can have 1 or more components (the wheels in a slot-machine metaphor), each with an independent number of rows (the writing on the wheels). Two methods return these values:

  • numberOfComponentsInPickerView: - returns the number of wheels
  • pickerView:numberOfRowsInComponent: - returns the number of rows for a given wheel

For more information, please refer to the Apple Documentation for UIPickerViewDataSource.

49 questions
1
vote
1 answer

Cannot Assign UIPickerView Delegate or DataSource

For some reason I cannot assign UIPickerView's data source or delegate to my NSObject. I have an NSObject which extends UIPickerViewDataSource and UIPickerViewDelegate class STRepeatPicker: NSObject, UIPickerViewDataSource, UIPickerViewDelegate { …
1
vote
1 answer

UIView numberOfComponentsInPickerView unrecognized selector sent to instance

I know there's many questions for this issue out there, but I still cannot get my specific code to work. Sorry if this is noob question. This is literally my entire code below. If I break inside viewDidLoad my delegate and dataSource sets to self…
David Choi
  • 6,131
  • 10
  • 28
  • 28
1
vote
1 answer

Does not conform to protocol "UIPickerViewDataSource"

Why doesn't the view controller conform the UIPickerViewDataSource? I have checked everything I could do to debug it from the web. I have typed all the necessary functions for the protocols (Swift 3.1) but in vain. Here is my code: class…
1
vote
2 answers

Change the 2nd and 3rd pickerView acording to what row from the 1st picker is selected

I have 3 pickers like this: the 1st one is the generalPicker, the 2nd and 3rd are the same. In the generalPicker, I have an array (menu): ["Length", "Volume", "Mass"] and every time I want to choose, for example Mass from the generalPicker, I want…
Dani Turc
  • 39
  • 2
  • 11
1
vote
4 answers

Setting UITextField's inputView property to a UIPicker not working in Swift

Hello I am trying to pop a UIPickerView view programmatically when user clicks on textfield. I have tried this but it doesn't doing anything, it isn't working. Nothing is happening when I click the textfield class UserProfileTableViewController:…
hellosheikh
  • 2,929
  • 8
  • 49
  • 115
1
vote
2 answers

UIPickerView delegate methods not being called even though delegate has been set after [[UIPickerView alloc] init]

Title says it all really I have a method that is called to create the UIPickerView and in the same view controller as the delegate methods. The view controller implements the UIPickerViewDataSource and UIPickerViewDelegate protocols //…
1
vote
1 answer

Managing UIPickerView datasource between a UIVIewController, a custom UITableViewCell and a Utility Class

I have a custom UITableViewCell class that contains a Picker. The cell and it's contents are populated by a core data entity. Since this custom cell will be viewable in more than one view controller, I have a utility class that I want to have to…
Joe Viola
  • 31
  • 5
1
vote
1 answer

Xcode6 beta 7 Swift cannot use UIPickerViewDataSource

With Xcode6 beta 7 whenever i add the UIPickerViewDataSource in this way class MyClassVC: UIViewController, UIPickerViewDelegate, UIPickerViewDataSource { it gives me a compile error saying "Type MyClassVC does not conform to protocol…
r4id4
  • 5,877
  • 8
  • 46
  • 76
1
vote
3 answers

UIPickerView - remove curvature and add text

I'm trying to create a UIPicker where I can select minutes and seconds. Here's the code: - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView { return 2; } - (NSInteger)pickerView:(UIPickerView *)pickerView…
soleil
  • 12,133
  • 33
  • 112
  • 183
1
vote
1 answer

Generic or Single uipickerview to show in multiple viewControllers

I want to know how can i make a generic/single UIPickerView to display in multiple ViewControllers. I want to show a pickerView in multiple ViewController. Now how can i create it. I know how to create it like implement and write its delegate for…
Zar E Ahmer
  • 33,936
  • 20
  • 234
  • 300
1
vote
1 answer

UIPickerView does not display data in iOS 7

I'm using a UIPickerView and an UIToolbar, and adding it to a UIView and adding this view to my main view addTimePicker=[[UIPickerView alloc]init]; [addTimePicker setFrame: CGRectMake(0, 20, 0,…
0
votes
1 answer

uncaught exception 'NSRangeException'

I getting crash uncaught exception 'NSRangeException', reason: '*** __boundsFail: index 3 beyond bounds [0 .. 2]' in Objective C crashlytics issues at this line "label.text = [_addressTypeArray objectAtIndex:row];" please see the below code and…
0
votes
1 answer

Pickerview is showing empty on second click in the textfield, adn when i press Done or Cancel the App crashes

var gender = ["MALE","FEMALE", "Other"] var genderPicker: UIPickerView! = UIPickerView() // On the first click in the textfield the gender pickerview works fine, but if i press out and then i press again in the gender textfield the picker appears…
0
votes
2 answers

How conform to UIPickerViewDelegate and UIPickerViewDataSource outside of a ViewController?

I want to have multiple UIPickerViews in one scene without bloating my view controller with delegate functions. All the tutorials I've seen on UIPickerViews suggest using the view controller itself as the delegate of a UIPickerView. How can I move…
0
votes
0 answers

uipickerview index out if range

I'm trying to learn to code Swift and recently I faced a bug which is so embarrassing. I have 2 textfield which both are connected to a picker view. func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int)…
Am1rFT
  • 177
  • 1
  • 2
  • 11