uipickerview

disabling the values in one component of picker based on value selected in other component

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 13:48:54
问题 I am trying to implement a custom picker. It has 3 components. Now, I want to gray out some values in the second component based on the first component value selected. I have referred to many sites and tried googling out to disable the values.(To be precise, something like the uidatepicker where if we select feb, 29 and 30 will be grayed. But i am trying to do it in custom picker implementing my own contents). Could some one help me how to go about for disabling the values in custom picker? I

Dismissing UIPickerView on tapping background

こ雲淡風輕ζ 提交于 2019-12-11 13:27:47
问题 I am adding a uipickerview as the subview of the main view. To dismiss the pickerview on tapping the backgroud view, i am adding a UITapGestureRecognizer to the main view. I am using the following code to add the GestureRecognizer for main view UITapGestureRecognizer *gestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)]; gestureRecognizer.numberOfTapsRequired=1; gestureRecognizer.numberOfTouchesRequired=1; gestureRecognizer.delegate =

Load CoreData objects' string property into UIPickerView

亡梦爱人 提交于 2019-12-11 13:24:45
问题 Currently I have an entity named "Events" in a CoreData app. "Events" has one string property named "eventName". In the -(void)viewDidLoad I am trying to Fetch all the "Events" objects and load their "eventName" by alphabetical order into a UIPickerView. The ultimate end goal is through the use of a textField, buttons and the pickerView being add new objects in and remove unwanted objects out. Basically turning the UIPickerView into a UITableView. Currently I am able to save objects to the

Storing and Accessing Methods from the AppDelegate

☆樱花仙子☆ 提交于 2019-12-11 11:46:38
问题 I am new in iPhone Development. I have a method that requires input from one .m class and uses the information in another .m file. I heard that if you store the variables and the methods in the appdelegate you can access the information. How can I do that? Also, how can I have user store a number from a UIPickerView as a integer as a variable? Thanks a lot! 回答1: For storing basic data you can do this simply using NSUserDefaults //Setting an int [[NSUserDefaults standardUserDefaults]

Using UIPickerView to display different images upon selection in UIImageView

淺唱寂寞╮ 提交于 2019-12-11 10:42:36
问题 I have a UIPickerView filled with an array of tree types. I also have an empty UIImageView below that I would like to change upon the selection of the picker view. I got a label to change with the selection but cannot get images to change. Here is what I have so far EDIT EDIT : Now working! Correct Code below #import "ViewController.h" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view,

Unable to get pickerView.tag in -pickerView:accessibilityLabelForComponent: method

自作多情 提交于 2019-12-11 10:40:02
问题 Protocol: UIPickerViewAccessibilityDelegate Method: -pickerView:accessibilityLabelForComponent: Problem: Apple Documentation says - (NSString *)pickerView:(UIPickerView *)pickerView accessibilityLabelForComponent:(NSInteger)component But the pickerView which I get inside this method is NOT a UIPickerView*, but is a UIAccessibilityPickerElement, and hence using pickerView.tag inside this method crashes. I have 2 pickerviews in my view controller and I need to access the tag to identify them.

Issues with UIPickerView inside a StackView

眉间皱痕 提交于 2019-12-11 10:29:25
问题 I'm running into a problem with the size of my pickers when I put them inside of a stack view. The pickers change their size to their default size when they are put into the stack view. They do not do this when they are not placed into the stack view 回答1: Just add height and width constraints to your picker before you add it to your stackview and that should solve your problem. 来源: https://stackoverflow.com/questions/32854074/issues-with-uipickerview-inside-a-stackview

UItextfield with pickerview as firstresponder ios

China☆狼群 提交于 2019-12-11 08:11:49
问题 I had a UITextField which when tapped need to show a UIPickerView. Also the data selected in pickerview will be inserted in the textfield. To Achiceve it I am now using subhajit's SHPickerField. 回答1: I do have created a subclass of UITextField, it is easy to implement and use. Here is the GitHub link: Visit https://github.com/subhajitregor/SHPickerFieldExample Please see the example to see how to use. The Readme file is also updated now. 回答2: Try this let myPicker = UIPickerView() @IBOutlet

How to change the size of row in UIPickerView by button click?

时光怂恿深爱的人放手 提交于 2019-12-11 06:57:39
问题 I tried to do it in this way: call reloadAllComponents: when button is clicked but it doesnt call rowHeightForComponent: 回答1: From the documentation, it looks like reloadAllComponents: just calls the delegate for new data inside the components, but presumably doesn't ask for the size. Instead, I would try calling rowSizeForComponent: on each component. In the documentation for this method, it says, "Returns: The size of rows in the given component. This is generally the size required to

UIPickerView multi components in swift

て烟熏妆下的殇ゞ 提交于 2019-12-11 06:50:13
问题 I found this answer How do I setup a second component with a UIPickerView and it was helpful but I want to do more. I want to have the data of the second component dependent on the first. here is my code class timerScreen: UIViewController, UIPickerViewDelegate, UIPickerViewDataSource { // where all the outlets are setup @IBOutlet weak var pickerViewOutlet: UIPickerView! // where I try to set up all my variables and constants let cubesToWorkWith = ["3X3", "2X2", "4X4", "5X5", "6X6", "7X7",