uipickerview

How to Show UIPickerView when selecting UITextField

百般思念 提交于 2019-11-27 05:25:30
问题 Here is a screenshot of what I did till now: So what I am trying to do is when you select "pick a name" Textfield I need a Picker to show up, with the input @"Jack". 回答1: it will work for you .. i have edited it .and for that you have to set delegate for textfield. and create a UIPIckrView in NIb file. - (BOOL) textFieldShouldBeginEditing:(UITextView *)textView { pickrView.frame = CGRectMake(0, 500, pickrView.frame.size.width, pickrView.frame.size.height); [UIView beginAnimations:nil context

UIPickerView select and hide

自古美人都是妖i 提交于 2019-11-27 05:23:16
问题 How do you make a UIPickerView act like the one with a webview wherein there is a drop down selection box and instead of dropping down like usual websites do, the iphone makes it into a UIPickerView with all the selections in. When you select one, a check becomes visible beside your selection and changes the value of the drop box. And how do you put the "Done" button on top of the UIPickerView to dismiss the UIPickerView ? I already know that [pickerview setHidden:YES] is the method to use to

Xcode 8 / Swift 3 : Simple UIPicker code not working

亡梦爱人 提交于 2019-11-27 05:18:14
I have protocols: class ViewController: UIViewController, UIPickerViewDelegate, UIPickerViewDataSource { I have data: let muteForPickerData = ["minute(s)","hour(s)"] In viewDidLoad I have: muteForPicker.delegate = self muteForPicker.dataSource = self Then I have required methods: func numberOfComponentsInPickerView(pickerView: UIPickerView) -> Int { return 1 } func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { return muteForPickerData.count } func pickerView(pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {

Custom UIPickerView with three Components each showing label on Selection Indicator

喜欢而已 提交于 2019-11-27 02:51:48
问题 In my app I am trying to make an custom UIPickerView which contains three components(days, hours and minutes). I have already made the custom picker with three components. And Now I am stuck at how I can add the labels to the selection indicator which shows which component is for days, hours or minutes. I have already gone through each and every link or question posted on this site but none them helped me. I am trying to implement something like this image Can any one suggest me how can I

UIPickerView Height not changeable [duplicate]

∥☆過路亽.° 提交于 2019-11-27 02:51:02
问题 This question already has answers here : How to change UIPickerView height (28 answers) Closed 6 years ago . I'm trying to change PickerView's height self.pickerView = [[UIPickerView alloc] init]; self.pickerView.frame = CGRectMake(0, 0, frame.size.width, frame.size.height); Xcode log shows the following message: -[UIPickerView setFrame:]: invalid height value 274.0 pinned to 216.0 How can I change its height? 回答1: here are only three valid heights for UIPickerView (162.0, 180.0 and 216.0) .

UIPickerView - 1st row selection does not call didSelectRow

守給你的承諾、 提交于 2019-11-27 02:36:31
问题 I have a UIPickerView on my UIView along with a UITextField . I am letting the user select a value from the picker or enter a custom value in the text field. When the user selects any option from the picker, the variable values are changed fine (in the pickerView:didSelectRow:inComponent: ) method. But if the user does not select any value on the picker (coz they want to select the 1st option which is already selected), this method is not called and the selection is not reflected in the

How do you shrink a UIPickerView on the iPhone?

萝らか妹 提交于 2019-11-27 00:23:17
I would like to reduce the height of a UIPickerView in my iPhone app, so that it shows only one row and one column. The height of the picker view should be equal to the height of a row. I'm using Interface Builder to construct the UIPickerView , but I can't find an easy way to re-size this control. How do you shrink a UIPickerView ? Actually, you can slightly shrink the whole UIPickerView by applying an affine transform to an enclosing view. For example: CGSize pickerSize = [pickerView sizeThatFits:CGSizeZero]; pickerTransformView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f,

Select row After UIPickerView is loaded

我是研究僧i 提交于 2019-11-27 00:19:29
问题 I have an iPhone database app that loads a UIPickerView with data from a table. I want to set the selected row to a particular row from the data in another table. For example: Let's say I have a UIPickerView that is loaded with X number of names of the iPhone users' friends (the number of names is variable; it could be 1 or 1000 and all are entered into the database by the user). The iPhone user has a preference set that their current best friend is TED . I want the UIPickerView to be

Hide the cursor of an UITextField

半腔热情 提交于 2019-11-26 23:49:14
问题 I am using a UITextField with a UIPickerView for its inputView , so that when the user taps the text field, a picker is summoned for them to select an option from. Nearly everything works, but I have one problem: the cursor still flashes in the text field when it is active, which is ugly and inappropriate, since the user is not expected to type into the field and is not presented with a keyboard. I know I could hackily solve this by setting editing to NO on the text field and tracking touches

Add buttons to UIPickerView - Swift 1.2

前提是你 提交于 2019-11-26 23:29:19
问题 I would like to add two UIButtons in the UIPickerView (on top of it). Please take a look at the Cancel and Done buttons in this image: How can I do it? 回答1: I have solved this, answer in Swift: var pickerView = UIPickerView(frame: CGRectMake(0, 200, view.frame.width, 300)) pickerView.backgroundColor = .whiteColor() pickerView.showsSelectionIndicator = true var toolBar = UIToolbar() toolBar.barStyle = UIBarStyle.Default toolBar.translucent = true toolBar.tintColor = UIColor(red: 76/255, green: