I created a custom UIView FormDropdown class containing a question and a button in nib. The class also has an NSArray property, which should store various options for the button.
Thus, you can make this button, for example, using the viewDidLoad method:
FormDropdown *dropdown = [FormDropdown dropdownWithQuestion:@"This is an example question" andLabel:@"Select one" andOptions:[NSArray arrayWithObjects:@"One", @"Two", @"Three", nil]]; [self.view addSubview:dropdown];
Obviously, I would like the button, when pressed, to display the UIPickerView with the displayed options. But I was fixated on how to send parameters to any method. I know that I can attach an action to a button like this:
[dropdown.dropdownButton addTarget:self action:@selector(dropdownPressed:) forControlEvents:UIControlEventTouchUpInside];
.. but I don’t see how to pass parameters from the dropdown.options array to a method?
ios objective-c iphone uibutton uiview
cannyboy
source share