uipickerview

IOS, How to add a custom SelectionIndicator to a UIPickerView?

柔情痞子 提交于 2019-12-04 03:55:13
问题 I want to add a checkmark instead of the default SelectionIndicator for UIPickerView. I am trying to add an image as subview UIImageView * checkMark = [[[UIImageView alloc] initWithFrame:CGRectMake(0, 102, 13, 13)] autorelease]; [checkMark setImage:[UIImage imageNamed:@"pickerChechmark.png"]]; checkMark.layer.borderColor = [[UIColor redColor] CGColor]; checkMark.layer.borderWidth = 2; [picker addSubview:checkMark]; but its been added behind the picker see the following image. image 1 for x =0

How to set the background color of UIPickerView on iOS 7 using SDK 7?

僤鯓⒐⒋嵵緔 提交于 2019-12-03 23:03:47
How to set the background color of UIPickerView on iOS 7 using SDK 7 and use a standard picker on iOS 5 and 6 ? It's transparent by default on iOS 7. What's wrong with: [picker setBackgroundColor:[UIColor whiteColor]]; I'm assuming you have a reference to the picker view if you're invoking it, and it's a subclass of UIView so backgroundColor is a valid property... I wanted to write it as a comment, but it would be hard to read :) Sooo.... -(UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view { UILabel *label = [

How do I add multiple components to a PickerView?

回眸只為那壹抹淺笑 提交于 2019-12-03 22:21:38
问题 It may be a simple question but how do I add multiple components to a UIPickerView? I use NSMutableArray to populate one component but I dont know how to populate the others. I also need to change the value of a label when a row is selected. Thanks in advance Kieran 回答1: I take it that you are a beginner. Here's how to implement the methods nacho has rightly pointed out: - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView { // return the number of components required return

How to make an UIPickerView with a Done button?

不打扰是莪最后的温柔 提交于 2019-12-03 18:20:43
问题 I am having difficulties to make an UIPickerView with a done button to appear when the users taps a UITextField. This is my code so far. Everything builds fine, but when I tap the text field, the keyboard appears, not the picker. class ViewController: UIViewController, UIPickerViewDataSource, UIPickerViewDelegate { @IBOutlet var textField1: UITextField! let pickerData = ["11", "12", "13"] @IBAction func textButton(sender: AnyObject) { let picker: UIPickerView picker = UIPickerView(frame:

How to Change Color selected Picked value from pickerview?

妖精的绣舞 提交于 2019-12-03 17:34:51
pickerArray = [[NSArray arrayWithObjects:@"20", @"40", @"60",@"80", @"100", @"120", @"140", @"160", @"180", @"200",nil] retain]; - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { //On Selecting the component row if (component == 0) { } else if (component == 1) { [quantityPickerDelegate didChangeLabelText:[pickerArray objectAtIndex:row]];// delegate passing the selected value pickerLabel.textColor = [UIColor colorWithRed:0.0745 green:0.357 blue:1.0 alpha:1]; } - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row

UIPickerView infinite rows

删除回忆录丶 提交于 2019-12-03 16:37:34
As seen in UIDatePicker you can scroll up endlessly (as well as down for that matter). I want to accomplish that too, because I want people to select a date such as: 1 January, 2010 2 January, 2010 ... 30 December, 2010 31 December, 2010 1 January, 2011 .. So it can go on forever. How would I accomplish this? Since I can only give a specific amount of rows in the delegate. I don't think you can actually make the UIPickerView loop, but the way I've done it in the past is to return a really large number from numberOfRowsInComponent and then calculate the modulus of the row to return the

UICollectionView with infinite scrolling?

人盡茶涼 提交于 2019-12-03 15:39:57
I'm attempting to implement a collection view with an infinite scrolling behaviour. The scrolling should be circular - like in a UIPickerView . Can it be done with Apple's UICollectionView or there is no choice but to create a horizontal PickerView ? What do you think? You should watch the WWDC 2011 session video "Advanced ScrollView Techniques", they talk about infinite scrolling, and I'm pretty sure it's possible to use that with UICollectionView s. It recenters while you scroll, and places the new items after the current visible items (or before, depending on the scroll direction). Like

how to pop up datePicker when text filed click and disappear when editing done

六眼飞鱼酱① 提交于 2019-12-03 13:22:16
i have view something like below date picker view is always there how can i make it appear pop up when Enter date is clicked and when i click on back ground then date picker should go down i have just made date picker view customary but i dont know how to do this appear and disappear thing Fire Fist Ok. Here is some sample code for your requirement with animation. - (void) showView { [self.view addSubview:yourDatePickerView]; yourDatePickerView.frame = CGRectMake(0, -250, 320, 50); [UIView animateWithDuration:1.0 animations:^{ yourDatePickerView.frame = CGRectMake(0, 152, 320, 260); }]; } And

UIPickerView with custom views broken in iOS7

大兔子大兔子 提交于 2019-12-03 12:42:00
I have an app with a UIPickerView. I am returning a custom view with the method - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view It looked fine in iOS 6. In iOS 7, not so much -- screen shot below. Notice that in the cells that don't have focus, the second and third columns overlap. The central row is correct. Any suggestions? imihaly It seems that for a strange reason, if the width of any column is higher than 1/3 of the picker view's width the layout breaks. So if you have a 320 pixel wide picker view 106

UIPickerView reloadData

痞子三分冷 提交于 2019-12-03 10:28:06
I'm changing components (in particular, the number and color of components), in a UIPickerView that I call pickerOne, so after making the changes, I call: [pickerOne reloadData]; and it appears to be working perfectly however, I'm getting a compile warning: warning: 'UIPickerView' may not respond to '-reloadData' Although this appears to work, is there something else that I should use to reload data? Thanks I think you should be using: reloadComponent: or reloadAllComponents: You should be calling reloadComponent: or reloadAllComponents: . There may be a private reloadData used under the