uipickerview

Customizing UIPickerView (background and spacing)

纵饮孤独 提交于 2019-12-30 03:31:07
问题 I would like to change the white background in a UIPickerView to an image of my own. Is this possible? Also, I have managed to get my UIPickerView to scroll horizontally instead of vertical. Now, I would like to know if there is any way to adjust the spacing between two rows of the picker view? I have attached an image to show what I mean. This is my code: - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view from its nib. arrayDays = [[NSMutableArray

Changing UIPickerView row height

前提是你 提交于 2019-12-30 03:02:39
问题 I'm working on a program for a class I'm taking and part of the program requires a UIPickerView with images in it. I have the picker up and running, but the height of the rows in the picker are still too small, causing the images (100x100) to overlap. I'm looking for a way to change the UIPickerView so that the images will fit in one row, without overlapping. Thanks 回答1: In the documentation for the UIPickerView, you have a link to the UIPickerViewDelegate protocol. There is a method that you

UIPickerView won't allow changing font name and size via delegate's `attributedTitleForRow…`

爷,独闯天下 提交于 2019-12-30 02:37:06
问题 I use the following func to change the font color and font size, the color works but the font name and font size refuse to work. func pickerView(pickerView: UIPickerView, attributedTitleForRow row: Int, forComponent component: Int) -> NSAttributedString? var myTitle = NSAttributedString(string: titleData, attributes: [NSFontAttributeName:UIFont(name: "Arial-BoldMT", size: 45)!, NSForegroundColorAttributeName:UIColor.whiteColor()]) any help? Thx. 回答1: I have a another option may be it helpfull

How to change UIPicker Color ? iPhone

假装没事ソ 提交于 2019-12-30 02:28:05
问题 I have observed that UIPicker always remains in black color, Is there any way to change the color of UIPicker & it's Selection Indicator? Thanks for helping me. 回答1: I assume all you want to change is the color of the border of the picker, not of the region in the center with which the user interacts. In this case, do the following: Create 4 "cover" UIViews and add them directly to the UIPicker, as in: [picker addSubview: coverView]; Position these views over the top, bottom, left and right

How to distinguish between multiple uipickerviews on one page

孤街浪徒 提交于 2019-12-29 09:57:08
问题 I have 2 uipickerviews in one uiviewcontroller: dropdown_1.frame=CGRectMake(...); dropdown_2.frame=CGRectMake(...); I have 2 different array of values for these 2 dropdowns > arraySizes5 = [sverysmall, ssmall, snormal, slarge, sverylarge]; > arraySizes3 = [ ssmall, snormal, slarge]; I have function like : . func numberOfComponentsInPickerView(pickerView: UIPickerView) -> Int { return 1 } func pickerView(pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { return

UIPickerView for each text field with different arrays (Swift/Firebase)

前提是你 提交于 2019-12-29 01:06:31
问题 I am trying to create a form in which each text field has a UIPickerView which the user can use to select the option needed. I need a to use a different array of information for each text field but I can't seem to get it to work and I have been stuck on it for quite a while now. I have had a method which was possibly working but I couldn't then retrieve the data from the text field for Firebase due to each field having the same name. Here is my code so far, this is the latest method that I

How to disable UITextField editing but still accept touch?

≡放荡痞女 提交于 2019-12-28 02:31:05
问题 I'm making a UITextField that has a UIPickerView as inputView . Its all good, except that I can edit by copy, paste, cut and select text, and I don't want it. Only the Picker should modify text field. I've learned that I can disable editing by setting setEnabled or setUserInteractionEnabled to NO . Ok, but the TextField stop responding to touching and the picker don't show up. What can I do to achieve it? 回答1: Using the textfield delegate, there's a method - (BOOL)textField:(UITextField *

Responding to touchesBegan in UIPickerView instead of UIView

烈酒焚心 提交于 2019-12-28 02:11:47
问题 I have a UIPickerView that gets faded out to 20% alpha when not in use. I want the user to be able to touch the picker and have it fade back in. I can get it to work if I put a touchesBegan method on the main View, but this only works when the user touches the View. I tried sub-classing UIPickerView and having a touchesBegan in there, but it didn't work. I'm guessing it's something to do with the Responder chain, but can't seem to work it out. 回答1: I've been searching for a solution to this

How to change UIPickerView image

二次信任 提交于 2019-12-27 06:01:51
问题 i have a custom horizontal UIPickerView like this i want to change the image like this and i don't know how to do . 回答1: i have tried this code [[[self._picker1 subviews] objectAtIndex:3] setAlpha:0.0]; // this view contains the background so you can change it with your new background // object at index 4 is your labels or images so they must be shown [[[self._picker1 subviews] objectAtIndex:5] setAlpha:0.0]; [[[self._picker1 subviews] objectAtIndex:6] setAlpha:0.0];// this is you indicator ,

Different picker values in different cells of same tableview

烈酒焚心 提交于 2019-12-25 20:03:46
问题 I have some tableview cells loaded like this.. Here, the qty field gets value from the picker field. But the issue is though both fields does show the picker fields, the data as per what is selected in the picker field is shown in the 2nd field only and in the 1st field, though I select a value from the picker field, that value is shown in the 2nd picker field instead of the 1st. My picker view has 10 values defined in viewDidLoad like so... self.noOfItems = ["1","2","3","4","5","6","7","8",