uipickerview

Display UIPickerView when UITextField is clicked

匿名 (未验证) 提交于 2019-12-03 10:24:21
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have a screen with many text fields on it. For one particular text field, I need it to show a picker from which the user can pick state names, once the user has picked a state by clicking on the states name, the picker should disappear. I am not quite sure how to do this, I have made the Nib file which looks like this. And here is my header file: #import <UIKit/UIKit.h> #import "APIHelper.h" @interface AddNewAddressViewController : UIViewController < UIPickerViewDelegate , UIPickerViewDataSource , UITextFieldDelegate > {

How do I get a list of countries in Swift ios?

家住魔仙堡 提交于 2019-12-03 09:52:04
I've already seen two similar questions to mine, but the answers for those questions do not work for me. I have an old project with a list of countries manually typed out inside a set of square brackets. I can easily use this in my pickerView but I'm wondering if there is a more efficient way to do this? I will be using the list of countries in a UIPickerView. Ian You can get a list of countries using the NSLocale class's isoCountryCodes which returns an array of [String] . From there, you get the country name by using NSLocale 's displayName(forKey:) method. It looks like this: var countries:

UIPickerView disable row selection

天大地大妈咪最大 提交于 2019-12-03 09:20:52
问题 I want to disable the selection of certain rows in my UIPickerView . Like in the Coundown timer, where you try to choose 0, it doesn't let you and slips back up to 1. Or how you can limit the date in the Date Picker ... How do a disable rows in a UIPickerView ? 回答1: In UIPickerView delegate method - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component you can check if this selection is valid and scroll to the appropriate row if it is not

UIPickerView Inside UITableView Using DateCell

匿名 (未验证) 提交于 2019-12-03 08:30:34
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I used the amended DateCell code from the following link DateCell without storyboard . I want to replace UIDatePicker with UIPickerView . Below is the code that I have amended/commented to make it work for UIPickerView . On each cell tap, I'm able to show UIPickerView but it only loads once and for the rest of the cells UIPickerView with same row titles appears and it crashes when I select a row from UIPickerView . I'm stuck into this for last couple of days. Any help would be highly appreciated. MoreTableViewController.h #import <UIKit

Multiple pickerviews with multiple textfield inputviews Swift

微笑、不失礼 提交于 2019-12-03 06:39:17
I've been searching through the forum and nothing has helped. I am using 4 text fields in one view controller, and for each textfield, I am using a separate pickerView as the inputViews for the textFields (4pickers). When I click on the first textField, pickerView1 successfully appears and the textfield displays the data, however when I click on the second, third and fourth textfields,the first pickerView appears. I suspect the error lies in the inputView declarations. And I would so appreciate it if you could help add a "done" button to the pickerView. My code: class ViewController1:

Multiple UIPickerView in the same UIView

女生的网名这么多〃 提交于 2019-12-03 05:06:42
问题 I'm a complete beginner on iOS dev and I want to create a little iOS application. On this application, 3 UIPickerViews are supposed to display different data. My problem is on the display. I'm used to dev on Android or Windows phone and I don't understand how to populate the UIPickerViews with different data. This is the code I have already written: // // ViewController.swift // iphoneVersion // // Created by fselva on 13/05/2015. // Copyright (c) 2015 fselva. All rights reserved. // import

how to show pickerview in uitextfield not the keyboard?

夙愿已清 提交于 2019-12-03 04:35:18
问题 I want to show a UIPickerView on becoming FirstResponder of a UITextfield not the keyboard and fill the value in text field form the picker view. any one knows this? 回答1: Edit: this answer was correct at the time of writing. Apple has since introduced inputView . Mafonya answer is what you should be doing nowadays. It is possible to prevent the keyboard from popping up. Set your class to be the delegate of the UITextField: textField.delegate = self and add: <UITextFieldDelegate> after your

UIPickerview best practice?

不羁岁月 提交于 2019-12-03 04:19:40
问题 One short question: on a registration process I would like to ask the user to choose a value from a list of values. Is it the right way to use a view Controller adding there all text fields and for the values a picker view? As the picker view needs so much space in between the text fields area I wonder what the best practice in this case would be? this is my code so far: class RegisterViewController: UIViewController, UIPickerViewDelegate, UIPickerViewDataSource{ @IBOutlet weak var

UIPickerView selection indicator not visible in iOS10

匿名 (未验证) 提交于 2019-12-03 02:51:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I build my project in Xcode 8. UIPickerView separator lines are not visible in iOS 10 simulator and the devices, but works fine on iOS 9.3 devices and simulator. I tried to adjust the UIPickerView back ground color, auto layouts and everything possible in the XIB, but nothing works. Anyone have an idea on this? This is a custom view which contains a UIPickerView -(void)layoutSubviews{ isShown = NO; [super layoutSubviews]; //self.selectedDic = nil; self.doneBtn.tintColor = COLOR_DB3535; self.pickerView.backgroundColor = COLOR_DEDEDE; self

UIPickerView won&#039;t allow changing font name and size via delegate&#039;s `attributedTitleForRow…`

匿名 (未验证) 提交于 2019-12-03 02:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: 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 for you.. Do all work that need for normal picker