uipickerviewdatasource

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

送分小仙女□ 提交于 2021-02-19 07:53:10
问题 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 to get in the 2nd and 3rd pickers this array: ["Milligram", "Centigram", "Gram", "Kilogram", "Stone", "Pound", "Ounce"]. Or, if I chose in the generalPicker, let's say, Length, then I want to get in the 2nd and 3rd pickers: ["Millimeter",

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

UITEXTFIELD InputView Uipicker not working in swift

大兔子大兔子 提交于 2019-12-13 04:56:42
问题 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: UITableViewController,UITextFieldDelegate,UIPickerViewDelegate,UIPickerViewDataSource { var itemPicker: UIPickerView! = UIPickerView() @IBOutlet weak var genderTxtField: UITextField! var gender = ["MALE","FEMALE"] override func viewDidLoad() { super

Multiple UIPickerview Errors

感情迁移 提交于 2019-12-13 04:12:07
问题 I just wanna let you know that the version of Xcode that I'm working on is 7.1.1. Getting to the point, I have three Pickerviews as is shown in the image below. Main pickerview, left pickerview, and right pickerview. The array of main pickerview has a group of names, and each name has a group of units, and the right and left pickers are supposed to have the same data. I have made a dictionary in order to sync those groups of units to where it belongs, but I could not do it. I tagged the main

UIPickerView selectRow not working as expected

无人久伴 提交于 2019-12-10 22:47:16
问题 I've created a UIPickerView which has two components, the first component (A) has a fixed number of rows set at 13. The other component (B) has a variable number of rows which is dependant on the row selected in (A). When loading the UIPickerView I am calling the following so that I can default the selection in both components, however the issue Im having is that only component (A) shows the correct values. Component (B) doesn't show the correct set of rows or the correct selection. [picker

Type “myViewController” does not conform to protocol UIPIckerDataSource in Swift

亡梦爱人 提交于 2019-11-28 19:07:39
I just create a new class in Swift, it's called myViewController and it's a UIViewController . Now I'm trying to make it a UIPickerViewDelegate and DataSource but i got a strange error import UIKit class myViewController: UIViewController, UIPickerViewDelegate, UIPickerViewDataSource { ... } It says Type "myViewController" does not conform to protocol UIPIckerDataSource over the UIPickerViewDataSource. Is it a bug of Xcode-Beta 3?? salman140 You need to implement all the required methods of UIPickerViewDataSource and UIPickerViewDelegate , if you want to conform to these protocols. Swift is

UIPickerView: NSAttributedString not available in iOS 7?

无人久伴 提交于 2019-11-28 01:09:48
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)component NS_AVAILABLE_IOS(6_0); // attributed title is favored if both methods are implemented - (UIView *

Type “myViewController” does not conform to protocol UIPIckerDataSource in Swift

£可爱£侵袭症+ 提交于 2019-11-27 20:27:20
问题 I just create a new class in Swift, it's called myViewController and it's a UIViewController . Now I'm trying to make it a UIPickerViewDelegate and DataSource but i got a strange error import UIKit class myViewController: UIViewController, UIPickerViewDelegate, UIPickerViewDataSource { ... } It says Type "myViewController" does not conform to protocol UIPIckerDataSource over the UIPickerViewDataSource. Is it a bug of Xcode-Beta 3?? 回答1: You need to implement all the required methods of

Xcode 8 / Swift 3 : Simple UIPicker code not working

亡梦爱人 提交于 2019-11-27 05:18:14
I have protocols: class ViewController: UIViewController, UIPickerViewDelegate, UIPickerViewDataSource { I have data: let muteForPickerData = ["minute(s)","hour(s)"] In viewDidLoad I have: muteForPicker.delegate = self muteForPicker.dataSource = self Then I have required methods: func numberOfComponentsInPickerView(pickerView: UIPickerView) -> Int { return 1 } func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { return muteForPickerData.count } func pickerView(pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {

Xcode 8 / Swift 3 : Simple UIPicker code not working

巧了我就是萌 提交于 2019-11-26 11:30:38
问题 I have protocols: class ViewController: UIViewController, UIPickerViewDelegate, UIPickerViewDataSource { I have data: let muteForPickerData = [\"minute(s)\",\"hour(s)\"] In viewDidLoad I have: muteForPicker.delegate = self muteForPicker.dataSource = self Then I have required methods: func numberOfComponentsInPickerView(pickerView: UIPickerView) -> Int { return 1 } func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { return muteForPickerData.count } func