uipickerview

Hiding/ Showing UIPickerView

那年仲夏 提交于 2019-11-27 20:08:46
I Have an a touchesEnded event that checks for when a UITextField is pressed. What I would like it to do is is hide/show a UIPickerView. How can this be done? - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{ UITouch *touch = [[event allTouches] anyObject]; if (CGRectContainsPoint([self.textField frame], [touch locationInView:self.view])) { NSString * error = @"Touched the TextField"; UIAlertView * errorAlert = [[UIAlertView alloc] initWithTitle:@"Selection!" message:error delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [errorAlert show]; //Want to show or hide

Get selected value of a picker view that is present in different view and use the string in some other view

笑着哭i 提交于 2019-11-27 19:41:16
问题 I have a picker view in a view controller page,say view controller1.Now I have a requirement of accessing the selected string value from that picker view in another view controller say view controller 2. This is because,I have a table view which displays the saved data corresponding to 4 groups i.e. my application is reminder application which user saves the reminder,that is visible in view reminder page.The reminders are saved by the user in respective groups,say friends,family,office etc...

Customize UIPickerView's Skin with images

别来无恙 提交于 2019-11-27 18:20:09
问题 I am developing an iPhone application. Where in, I want to have UIPickerView as in the image. Is it possible to change the appearance of UIPickerView like this?! Please guide me to do this!! I am creating it without XIB. Or is there a way to make UIPickerView skin transparent? Thanks in advance!! :-) 回答1: I dont know this is a correct way or not but you can set your UIPickerView background image ... I have done it once. See this :- //Make a view to set as background of UIPickerView UIView *

Assertion failure on picker view

主宰稳场 提交于 2019-11-27 17:15:07
问题 I'm getting an assertion failure while scrolling a picker view w/ zero data(zero rows). While scrolling the picker view I'm getting this crash. Testing on iOS 6 * Assertion failure in -[UITableViewRowData rectForRow:inSection:], /SourceCache/UIKit_Sim/UIKit-2372/UITableViewRowData.m:1630 * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'request for rect at invalid index path ( 2 indexes [0, 0])' Any help is appreciable. 回答1: I've the same problem I don't

UIDatePicker in UITextField in UITableView realtime update

痴心易碎 提交于 2019-11-27 16:49:29
问题 This question has been bugging me a LOT lately. Any help would be appreciated. These were my objectives: Setup a UIDatePickerView for a UItextField in a UITableViewCell. I have done all this so far, and I can see the picker working fine. Whenever I change the picker Value, I use NSLog to display the current value and it is working fine for every change. This is what I want: ** Whenever I change the pickervalue, I need the value to also be changed automatically in the UITextField (which is in

手写UIDatePicker和UIPickerView

被刻印的时光 ゝ 提交于 2019-11-27 16:35:16
// // ViewController.h // 手写 UIDatePicker // // Created by 非凡 程序员 on 15/11/13. // Copyright (c) 2015 年 非凡 程序员 . All rights reserved. // #import <UIKit/UIKit.h> @interface ViewController : UIViewController @property ( nonatomic , strong ) UIDatePicker *datePicker; @end // // ViewController.m // 手写 UIDatePicker // // Created by 非凡 程序员 on 15/11/13. // Copyright (c) 2015 年 非凡 程序员 . All rights reserved. // #import "ViewController.h" @interface ViewController () @end @implementation ViewController - ( void )viewDidLoad { [ super viewDidLoad ]; // 定义一个 datePicker _datePicker = [ [ UIDatePicker alloc

UIPickerView - Loop the data

我们两清 提交于 2019-11-27 16:02:36
问题 I'm currently developing an app using Swift where I use a UIPickerView, see below for image. Currently the UIPickerView stops when the user has scrolled to the last data, but i want it no never stop. I want it to be possible to start from the first data by just keep on scrolling when you're at the bottom. Or scroll up when at the top. I want it to be like Apple's Countdown where you can drag up or down whenever you want. How I want it to be: How it currently is: 回答1: There will be four steps

Can I programmatically scroll to a desired row in UIPickerView?

折月煮酒 提交于 2019-11-27 15:30:53
问题 By default the first row is highlighted after initializing the UIPickerView. How do i highlight a particular row or scroll to particular row programmatically? 回答1: As always, this is thoroughly documented. The Apple documentation for UIPickerView should tell you that the method you probably want is – selectRow:inComponent:animated: . 回答2: If you want to trigger delegate's method pickerView:didSelectRow:inComponent, you should call it manually: Obj-C [self.myPickerView selectRow:0 inComponent

How to change the color of UIPickerView Selector

限于喜欢 提交于 2019-11-27 15:17:34
I am having a UIPicker, I want to change the color of the selector. Is it possible to change the color of the selector? I suppose you're dealing with the iPhone SDK? There may be some other frameworks which uses this name, so maybe you can add your tags to include uikit, cocoa-touch or something. Anyway, you can set showsSelectionIndicator of the UIPickerView instance to NO, so it hides the selector. Then you can create a new view with the adjusted selection style, and add it to the superview above the UIPickerView. // Some sample code, but you can do this in IB if you want to _pickerView = [

swift UIAlertController with pickerView button action stay up

☆樱花仙子☆ 提交于 2019-11-27 14:49:59
问题 I am new in swift and I am trying to make UIAlertContoller with PickerView but I have problems with the Buttones, Here a photo I am trying to change the constraint of the buttons to stay up. I read a lot of answers here but I did not find any solution Here is my code: func distance(){ let editRadiusAlert = UIAlertController(title: "Choose distance", message: "", preferredStyle: UIAlertControllerStyle.alert) let pickeViewFrame: CGRect = CGRect(x: 0, y: 0, width: 250, height: 300) let