uipickerview

Customize text color of UIDatePicker for iOS7 (just like Mailbox does)

荒凉一梦 提交于 2019-11-27 09:41:12
问题 I'm having the most frustrating dilemma. I've researched up and down and can clearly see that Apple does not want us tampering with iOS 7. Well, I want to tamper. And, the team at Mailbox clearly figured out how to do it and get approved. The main thing that I'm trying to achieve is to change the label color to white. My first thought was they are using a custom UIPickerView that just mimics a UIDatePicker, but I just don't think this is the case. I zoomed in on a small fragment and

Elegantly replace iPhone keyboard with UIPickerView

不打扰是莪最后的温柔 提交于 2019-11-27 09:34:07
问题 I have a table view that has embedded UITextFields for entering some data. It also has two other fields that popup a UIPickerView and a UIDatePicker - as demonstrated in the DateCell example from Apple. Mostly it works but I can't figure out how to cleanly transition from the text field keyboard to the other pickers - one slides out, one slides in - it looks weird and the scroll position on the table view sometimes gets screwed up - with everything scrolled off the top. What I'd like to do is

UIPicker detect tap on currently selected row

左心房为你撑大大i 提交于 2019-11-27 08:13:06
I have a UIPickerView and The method didSelectRow is not called when tapping on a selected row . I need to handle this case. Any ideas? Nikolay Shubenkov First, conform the class to the UIGestureRecognizerDelegate protocol Then, in the view setup: UITapGestureRecognizer *tapToSelect = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tappedToSelectRow:)]; tapToSelect.delegate = self; [self.pickerView addGestureRecognizer:tapToSelect]; And elsewhere: #pragma mark - Actions - (IBAction)tappedToSelectRow:(UITapGestureRecognizer *)tapRecognizer { if (tapRecognizer.state ==

Is there any way to add UIPickerView into UIAlertController (Alert or ActionSheet) in Swift?

不羁的心 提交于 2019-11-27 07:27:03
I'm totally new to swift (and iOS programming at all), but I started messing around with it (it wasn't a good idea when everything is still beta version :D). So I tried to figure it out by myself, but still nothing. Even tried to add subview containing picker without any success. So can any one help me? Well this is my final code which worked for me. It is a mix by a few ideas. The main reasons that I will accept my answer is that my code is in Swift, my code uses UIAlertController, my code is for picker. I want to thank to Jageen - my answer is based on his idea. func showPickerInActionSheet

is there a uipickerview delegate method like scrollviewDidScroll?

你。 提交于 2019-11-27 07:04:12
问题 I have a customized UIPickerview and I do not want to use a datepicker. I want to implement the feature where when a user scrolls down/up the hours, the AM/PM component switches while the hour is scrolling. This means that I need to switch it before pickerView didSelectRow is called. Is there a way to do this? Thanks 回答1: Use following method, - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { // put your logic here. } Above method is

display done button on UIPickerview

六月ゝ 毕业季﹏ 提交于 2019-11-27 06:50:36
I have written the following code in the viewDidLoad method: categoryPickerView=[[UIPickerView alloc]init]; categoryPickerView.alpha = 0; [self.view addSubview:categoryPickerView]; categoryPickerView.delegate=self; categoryPickerView.tag=1; and called this method to hide picker view - (IBAction)hidePickerView:(id)sender { [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.6]; CGAffineTransform transfrom = CGAffineTransformMakeTranslation(0, 200); categoryPickerView.transform = transfrom; categoryPickerView.alpha = categoryPickerView.alpha * (-1) + 1; [UIView

How to steal touches from UIScrollView?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 06:48:38
Today on my creative time I did some quite comprehensive research on how to steal touches from a UIScrollView and send them instantly to a specific subview, while maintaining the default behavior for the rest of the scroll view. Consider having a UIPickerView inside of a UITableView. The default behavior is that if you drag your finger over the picker view, the scroll view will scroll and the picker view will remain unchanged. The first thing I tried was to override - (BOOL)touchesShouldCancelInContentView:(UIView *)view and simply not allow the UIScrollView to cancel touches inside the picker

Add UIPickerView in UIActionSheet from IOS 8 not working

寵の児 提交于 2019-11-27 06:33:18
I am adding UIPickerView to UIActionsheet but its working perfectally in ios 7 but not working in ios 8 . Please help me to solve that. Here i attached screenshot for that. Thanks I am using following code for that. UIActionSheet *actionSheet; NSString *pickerType; - (void)createActionSheet { if (actionSheet == nil) { // setup actionsheet to contain the UIPicker actionSheet = [[UIActionSheet alloc] initWithTitle:@"Please select" delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil]; actionSheet.backgroundColor = [UIColor clearColor]; UIToolbar *pickerToolbar = [

How to disable UITextField editing but still accept touch?

二次信任 提交于 2019-11-27 06:31:10
I'm making a UITextField that has a UIPickerView as inputView . Its all good, except that I can edit by copy, paste, cut and select text, and I don't want it. Only the Picker should modify text field. I've learned that I can disable editing by setting setEnabled or setUserInteractionEnabled to NO . Ok, but the TextField stop responding to touching and the picker don't show up. What can I do to achieve it? Using the textfield delegate, there's a method - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string Return NO from this

How do I change the color of the text in a UIPickerView under iOS 7?

最后都变了- 提交于 2019-11-27 06:17:09
I'm aware of the pickerView:viewForRow:forComponent:reusingView method, but when using the view it passes in reusingView: how do I change it to use a different text color? If I use view.backgroundColor = [UIColor whiteColor]; none of the views show up anymore. Jon There is a function in the delegate method that is more elegant: Objective-C: - (NSAttributedString *)pickerView:(UIPickerView *)pickerView attributedTitleForRow:(NSInteger)row forComponent:(NSInteger)component { NSString *title = @"sample title"; NSAttributedString *attString = [[NSAttributedString alloc] initWithString:title