uipickerview

Is there any way to tell if UIPickerView is spinning?

我的未来我决定 提交于 2019-12-08 09:48:51
问题 Is there any way to tell if UIPickerView is spinning? I need to disable some UI elements when it is in transition. 回答1: There are no delegate method for this however you can check the animationKeys count since a UIPickerView is a subclass of UIView : BOOL isSpinning = myPickerView.layer.animationKeys.count > 0; if(isSpinning){ NSLog(@"disable"); }else{ NSLog(@"enable"); } Maybe pickerView:titleForRow:forComponent: is maybe a good place to put this code ? 回答2: I solved it by saving the row

How to pull the data from plist to UIPickerView?

元气小坏坏 提交于 2019-12-08 09:18:14
问题 can please help to provide the tutorial on how to pull the data from plist to UIPickerView? 回答1: 回答2: it useful for u. pickerViewcontroller.h #import <UIKit/UIKit.h> #define kStateComponent 0 #define kZipComponent 1 @interface PickerViewController : UIViewController <UIPickerViewDataSource,UIPickerViewDelegate>{ IBOutlet UIPickerView *dpicker; NSDictionary *stateZip; NSArray *states; NSArray *zips; } @property (nonatomic,retain) UIPickerView *dpicker; @property (nonatomic,retain) NSDictionary

How to store data from a picker view in a variable when a button is pressed?

有些话、适合烂在心里 提交于 2019-12-08 08:43:08
问题 I have a picker view with one component that I populated with an array of data. When the user presses a button, I want the selected data in that row to be stored in a variable so that I can send it to another view controller using a segue, where it will be displayed in a label. The only part I'm having trouble with is actually getting that data to be stored in order to be used somewhere else. I know that using a datePicker, I can do something like this to do what I want: @IBAction func

Take data from Enum to show on UIPickerView

旧街凉风 提交于 2019-12-08 08:10:32
问题 I am creating a simple View where there is a UIPickerView and I want to display the choices on the PickerView from an enum. I have created an enum of possible drinks enum drink{ case coffee case tea case cola case water } I was wondering how it would be possible to display the drinks in an UIPickerView? I am using Swift 1.2 and Xcode 6.3.1.. Thanks!! :) 回答1: As mentioned by ABakerSmith you can use the Printable protocol to display the String in the UIPickerView . In the end you can have a

Core Data - Getting Unique Rows

為{幸葍}努か 提交于 2019-12-08 07:52:45
问题 I'm working on an iPhone app that uses Core Data. I have only one entity called Books, and that entity has the attributes Title, Author, ISBN, Description and Shelf. I'm working on the book editing view, and want to have a UIPickerView listing all of the unique Shelf rows so that the user can just pick a shelf. My question is -- how do I get an NSArray of all of the unique Shelf attributes across all of the books in the database? I have access to the managedObjectContext of the Book being

How insert an images and text in specific rows of an UIpickerView?

本秂侑毒 提交于 2019-12-08 07:44:34
问题 I have implemented the following function: - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view { UIImage *img = [UIImage imageNamed:@"persona.jpeg"]; UIImageView *temp = [[UIImageView alloc] initWithImage:img]; temp.frame = CGRectMake(-70, 10, 60, 40); UILabel *channelLabel = [[UILabel alloc] initWithFrame:CGRectMake(50, -5, 80, 60)]; channelLabel.text = @"persona y"; channelLabel.textAlignment =

PickerView load up tableview data Swift

有些话、适合烂在心里 提交于 2019-12-08 07:26:58
问题 Currently, my uipicker has 3 selections, Cameron, Shaffer and Hydril. When I pick Cameron, i want my uitableview to load up camerondata1. If i pick Shaffer, I want it to load up camerondata2. How do I setup my UItableview to readjust according to the selection made on my picker view? I new to Swift programming. class Picker2: UIViewController, UIPickerViewDelegate, UITextFieldDelegate, UITableViewDataSource, UITableViewDelegate { var activeTextField:UITextField? let textCellIdentifier =

How can I save a second row of UIPickerView to NSUserDefaults?

送分小仙女□ 提交于 2019-12-08 06:45:54
问题 I have pickerView with two rows and I need to save position of both to NSUserDefaults. I have successful saved first row with this code: - (void)pickerView:(UIPickerView *)thePickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { NSInteger selectedRow = [thePickerView selectedRowInComponent:0]; [[NSUserDefaults standardUserDefaults] setInteger:selectedRow forKey:@"picker"]; } And I don't get how to add a second one. With this code I bring back the position: -(void

UIPickerView depending on UITableView

99封情书 提交于 2019-12-08 03:11:36
问题 I don't have much experience in programming, so here is my question: I'm trying to write a converter app. At the end, you can enter a number. Then I have a two component UIPickerView . With the first component, you select the input format (e.x. °Celcius). With the second component, you select the output format (e.x. °Fahrenheit), in order to convert °Celcius into °Fahrenheit. But I want to add more units (weight, energy etc.). I want them to display on a UITableView . If I select a certain

UIPickerView - Unable to tap item to select in ios7

一世执手 提交于 2019-12-08 01:54:46
问题 On iOS7 I have a UIPickerView with three components in my App (see image below). All three comonents can be rotated when swiped across. Fine! But normaly when user tapps BELOW or ABOVE the currently selected row, the picker wheel rotates the tapped value to the center. The middle (yellow) component bahaves as expected when tapped. But the left and right components behave strange: the do not react to the tap below or above. They can only be rotated when "swiped" - but not when clicked. See