uipickerview

UIPickerView: unexpectedly found nil while unwrapping an Optional value

蹲街弑〆低调 提交于 2019-12-11 20:35:02
问题 I am trying to implement a UIPickerView to my App. Though I haven't got an error, when I run the app it crashes with following error: unexpectedly found nil while unwrapping an Optional value class LobbyViewController: UIViewController { @IBOutlet weak var textfield: UITextField! var picker: UIPickerView! var radius = [2, 5, 10, 15, 20, 25, 50, 100, 1000] override func viewDidLoad() { super.viewDidLoad() picker.dataSource = self picker.delegate = self self.textfield.inputView = picker }

Customize UIPicker-Insert Images

烂漫一生 提交于 2019-12-11 20:20:03
问题 As seen image below, I am trying to customize my picker. I have successfully added images on my picker but not affected all other pickers.I have put my code as well for reference. Thanks a lot in advance, happy thanksgiving. - (void)loadView { picker1 = [[UIPickerView alloc] initWithFrame:CGRectMake(30, 200, 250, 250)]; picker1.delegate = self; picker1.dataSource = self; picker1.showsSelectionIndicator = YES; picker2 = [[UIPickerView alloc] initWithFrame:CGRectMake(390, 200, 250, 250)];

How to change text color when selected in uipickerview?

守給你的承諾、 提交于 2019-12-11 19:18:51
问题 I want to change the color of the row that the selection of the uipickerview lands on. There is another question like this but the only answer is showing how to make all the text in the uipickerview changed to a certain color. I just want the text when selected in the viewer to appear a different color. -(UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent: (NSInteger) component reusingView:(UIView *)view { NSString *rowItem =[thing objectAtIndex:row];

UIPickerView in UITableView doesn't react to touch in lower half of cell

人走茶凉 提交于 2019-12-11 19:15:35
问题 I have a UITableView with one cell only (I will need more later) that contains just a UIPickerView. The single component in the UIPickerView will only scroll when I begin touching it in the top half of the UIPickerView. It will not move at all if my touch starts in the lower half. I have set the following properties in interface builder for the UITableView: No selection Scrolling disabled Bounces: NO Bounces Zoom: NO Delays Content Touches: NO Cancellable Content Touches: NO How can I allow

Unable to use two UIPickerViews on one viewcontroller

巧了我就是萌 提交于 2019-12-11 18:32:37
问题 I currently have a view controller with 3 text fields: customerTextField manufacturerTextField modelTextField When selecting manufacturerTextField I need the UIPicker associated with https://www.example.com/example/Manufacturer.php to appear. This UIPicker by design has two columns that are populated using JSON data. When making the selection the UIPicker populates both manufacturerTextField and modelTextField When the user selects customerTextField I would like the UIPickerView to show the

Odd error when setting UIPickerview selection with appropriate date; selectRow causing error

瘦欲@ 提交于 2019-12-11 18:13:23
问题 I'm loading just 1 picker in a view, one component is months (which displays fine), the other displays the current year (as well as previous and next years); The picker displays just fine if I comment out the line to pre-select the value for the current month. Here is my code: [super viewDidLoad]; // Do any additional setup after loading the view. NSDate *date = [NSDate date]; NSCalendar *calendar = [[NSCalendar alloc]initWithCalendarIdentifier:NSGregorianCalendar]; NSDateComponents

How to make UIPickerView resignFirstResponder if user clicks in other place then UIPickerView

北城余情 提交于 2019-12-11 17:37:37
问题 I have created UIPickerView as following . Now i want to make it resignFirstResponder if user clicks in other place then UIPickerView How could i achieve that. I have created the UIPickerView as following way.Where else could I handle [pickerView removeFromSuperview]; -(void)pickerview:(id)sender { _items =[[NSArray alloc]initWithObjects:@"Hindi",@"English",@"In what city were you born?", @"What was your childhood nickname?", @"Type your own question.",nil]; pickerView=[[UIPickerView alloc]

Showing data in picker

泪湿孤枕 提交于 2019-12-11 15:07:51
问题 Can someone please explain to me why my picker is not showing any data when i load from plist This is plist: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>England</key> <array> <string>Chelsea</string> <string>Arsenal</string> </array> <key>Spain</key> <array> <string>Barca</string> <string>Real</string> </array> </dict> </plist>` This is part of viewController.m -

How to use MRCountryPickerDelegate

不想你离开。 提交于 2019-12-11 15:01:41
问题 I am trying to implement MRCountryPicker for selecting Country Flag and Code.I have installed pods. now i have no idea how can i get delegate method or how can i declare like this "MRCountryPickerDelegate" for more detail check out https://github.com/xtrinch/MRCountryPicker class ViewController: UIViewController, MRCountryPickerDelegate { i am getting this error Thanks for your appreciation's and help..Thank you. 回答1: If I understand your question properly, First you must "import

Option selected from one of the picker view duplicates in another picker view Swift

老子叫甜甜 提交于 2019-12-11 14:29:44
问题 I've a survey with 8 questions and each question has a picker view with options loading from the server. This is in the UI Collection View. The survey works fine upto 5 questions but when we added more than 5, whatever the option we pick for the question 1 gets selected both for question1 and 6. same with question 2 and 3 which returns Index out of range error and I see only 5 answers instead of 8. Any help is appreciated. Gif file of the CollectionView Errors Screen shot Here is my code: