uipickerview

UIPickerView select and hide

我只是一个虾纸丫 提交于 2019-11-28 04:36:00
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 hide the pickerview. I just don't know how to include the "Done" button in the UIPickerView . Regards,

Select row After UIPickerView is loaded

余生颓废 提交于 2019-11-28 04:16:11
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 position to TED when displayed. Where do I call selectRow ? I tried in viewDidAppear , but it was never called

Hide the cursor of an UITextField

独自空忆成欢 提交于 2019-11-28 02:47:25
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 on it, or by replacing it with a custom-styled button, and summoning the picker via code. However, I

Load data from json using UIPickerView

巧了我就是萌 提交于 2019-11-28 02:04:13
问题 My Current View Controller is like this import UIKit import Alamofire class ViewController: UIViewController , UIPickerViewDelegate, UIPickerViewDataSource{ @IBOutlet var venuePicker : UIPickerView? var result = [String:String]() var resultArray = [String]() override func viewDidLoad() { self.venuePicker?.delegate = self Alamofire.request(.POST, "http://example.com/xxx/xx/xx").responseJSON() { (request, response, jsonData, error) in var venues = JSON(jsonData!) let d = venues.dictionaryValue

UIPickerview customisation

不想你离开。 提交于 2019-11-28 01:46:43
问题 I would like to do some customization of the UIPickerView. End Goal: have a picker view rotating a few icon sized images. firstly i would like to change the black/grey boarder surrounding the spindle to a transparent colour. i.e. [UIColor clearColor]; Then shrink the picker view down so it is relatively small, (probably around 40 x 40 pixels) Experimenting with this is IB did not make it seem easy. Finally change the view returned to the picker for each section. This i think is easy with

Add buttons to UIPickerView - Swift 1.2

99封情书 提交于 2019-11-28 01:12:27
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? Dejan Skledar 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: 217/255, blue: 100/255, alpha: 1) toolBar.sizeToFit() let doneButton = UIBarButtonItem(title:

UIPickerView: NSAttributedString not available in iOS 7?

无人久伴 提交于 2019-11-28 01:09:48
It seems the UIPickerView no longer supports the use of NSAttributedString for picker view items. Can anyone confirm this? I found NS_AVAILABLE_IOS(6_0) in the UIPickerView.h file, but is this the problem? Is there a way around this, or am I out of luck? - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component; - (NSAttributedString *)pickerView:(UIPickerView *)pickerView attributedTitleForRow:(NSInteger)row forComponent:(NSInteger)component NS_AVAILABLE_IOS(6_0); // attributed title is favored if both methods are implemented - (UIView *

Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency',

谁说我不能喝 提交于 2019-11-27 23:31:13
问题 I created a toolbar above the picker with two buttons and worked on ios7, when i run in ios8 crash: Terminating app two to uncaught exception 'UIViewControllerHierarchyInconsistency', reason: 'child view controller: Should Have parent view controller: but requested parent is: ' This is the piece of code that worked quietly in ios7: expiredPromoTextField.inputView = DatePicker; expiredPromoTextField.delegate = self; quantityPromoTextField.inputView = quantityPicker; quantityPromoTextField

UIPickerView in UITableView

我怕爱的太早我们不能终老 提交于 2019-11-27 22:06:28
问题 First of all: I know that some people already posted topics like that, but nobody gave a clear answer in all those topics. I have a settings-UITableView in my application. Now i want to add a TableViewCell where i can choose between some numbers with a UIPickerView. In the tableView didSelectRowAtIndexPath method i created the if statement for the right cell -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ if (indexPath.row == 1){ } } How can i add a

UIPickerView as inputView of UITextField

假如想象 提交于 2019-11-27 21:53:20
I've read a lot about how I can use a UIPickerView as the inputView of my UITextField . The thing is, I am able to call the UIPickerView when I tap on the UITextField . However, my app always loads with the UIPickerView shown. I have already tried changing the myownpickerview.hidden = YES; in viewDidLoad , but this causes problems when I click on the UITextField . It won't show up, and if I click multiple times, the debugger shows that there would be an error. Can anyone point me in the right direction? I only want the UIPickerView shown after I tap on the UITextField I'm still working on my