uipickerview

iOS 7.1 UITapGesture not working with UIPickerView

孤者浪人 提交于 2020-01-09 04:47:29
问题 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 used to dismiss the picker via removing it's super view. In iOS 7.0 and previous versions, this was working as expected. However, in iOS 7.1 this set up is no longer working in the sense that UITapGestureRecognizer is not recognizing the tap and

(iOS) How to make first value in UIPickerView unselectable?

偶尔善良 提交于 2020-01-06 15:39:15
问题 I'm using UIPickerView with (for example) 4 rows. The first value is "Pick a value" with gray text. The others are values the user should pick with black text. The picking is optional, so users could just skip it. But if they don't, how to make first value unselectable back after user will start picking? Thanks. Regards. 回答1: Use the UIPickerView delegate method - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component to change the selected

Add font family and font size in UIPickerView

只愿长相守 提交于 2020-01-06 12:46:08
问题 I'm a newbie to iOS programming, I have a project and my requirements are 1: I have to add font family 2: In the same way, I have to add font size These are to be added with a done button on top and a bifurcation in between them. Guys I have searched and cant get it, kindly help me out. Thanks in advance. 回答1: Your picker view should have two components. The number of rows in the first component should be the count of the items in your font family list. The number of rows in the second

Swift: Json parse in two pickerView between country and city

有些话、适合烂在心里 提交于 2020-01-06 06:54:05
问题 I have two JSON Url. want to parse between two UIPickerView. one UIPickerView for Country, and another one for the city. I have been able to parse JSON in first UIPickerView of Country, in here data is coming perfectly. but I got a thread message in DidSelectRow func when clicking UIPickerView of the city. please try to solve this problem here is my code. var arrCountryPicker = [CountryPicker]() var arrCitiPicker = [CityPicker]() var id = 0 var country_id = 0 my two URL let url = URL(string:

Sorting an array by alphabetical order before it is selected by UIPickerView

我的未来我决定 提交于 2020-01-05 15:36:46
问题 I am new to iphone development and need some guidance to do custom sorting of an array in iOS. I would like to sort the objects that appear in the UIPickerView. The objects that are passed to the UIPickerView are in an array. When I print the array out, it looks like this: "<ObjectsInfo: 0x1c5249f0>", "<ObjectsInfo: 0x1c524940>", "<ObjectsInfo: 0x1c5248e0>", "<ObjectsInfo: 0x1c524890>", "<ObjectsInfo: 0x1c524840>", "<ObjectsInfo: 0x1c524a90>", When i print out the first object's name:

UIPickerView won't display the data loaded from NSUserDefaults - App is crashing while loading data

这一生的挚爱 提交于 2020-01-05 13:08:57
问题 I made a first try to use NSUserDefaults in an App with UIPickerViews. But the App is crashing while testing / the data isn't displayed in the PickerView. I still try to fix it myself but some help would be great. ViewController3: Where the user should save data to the NSUserDefault. Therefore there is an textField to write down something and a "Savebutton" class ViewController3: UIViewController, UITextFieldDelegate { @IBOutlet weak var textField: UITextField! ... @IBAction func

UIPickerView won't display the data loaded from NSUserDefaults - App is crashing while loading data

ⅰ亾dé卋堺 提交于 2020-01-05 13:08:12
问题 I made a first try to use NSUserDefaults in an App with UIPickerViews. But the App is crashing while testing / the data isn't displayed in the PickerView. I still try to fix it myself but some help would be great. ViewController3: Where the user should save data to the NSUserDefault. Therefore there is an textField to write down something and a "Savebutton" class ViewController3: UIViewController, UITextFieldDelegate { @IBOutlet weak var textField: UITextField! ... @IBAction func

UITableView scroll to specific section using UIPIckerView?

与世无争的帅哥 提交于 2020-01-04 17:46:28
问题 I have a UITableView that has a fixed number of sections, however the number of rows in each section can vary depending on server results. I would like to implement a picker wheel to "jump" to each section. Here are my UIPickerView delegate methods in the UITableViewController: - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView{ return 1; } - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component{ return 5; } -(NSString *)pickerView:

UITableView scroll to specific section using UIPIckerView?

扶醉桌前 提交于 2020-01-04 17:45:48
问题 I have a UITableView that has a fixed number of sections, however the number of rows in each section can vary depending on server results. I would like to implement a picker wheel to "jump" to each section. Here are my UIPickerView delegate methods in the UITableViewController: - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView{ return 1; } - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component{ return 5; } -(NSString *)pickerView:

Swift UIPickerView disable component

不想你离开。 提交于 2020-01-04 16:56:05
问题 I'm having following UI: Is it possible to disable only the last two components if the switch is used? If so, how can I do this? 回答1: You can not disable the components. However you can reload picker using reloadAllComponents method and you should reload only required components. Do not load time components. 回答2: You can not disable the components. However you can try these solutions. First solution: var selectedRow3 = 3 var selectedRow4 = 3 func pickerView(_ pickerView: UIPickerView,