uipickerview

Change color of selectedRow in UIPickerView, also when rolling

眉间皱痕 提交于 2019-12-22 11:31:21
问题 I have to change the color of the selected row in a UIPickerView . I did managed to change the color, i know that the question already have several replies, anyway those do not satisfy me: with those implementation, the animation of the pickerview is glitchy and i don't like it. This is the code of the current solution func pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) -> UIView { var label: UILabel if view == nil { label =

Most effective way to populate a picker view with range of integers?

為{幸葍}努か 提交于 2019-12-22 10:28:31
问题 I have a simple UI picker view in an iOS app (iPhone) and I'm looking to pre-populate it with a range of numbers on launch. What would be the most pragmatic/quickest/optimized way to populate it? I'm new to iOS development, so I'm just starting to test the waters. The documentation is pretty decent but I'd like to get some insight from seasoned developers on the most effective way to accomplish what I'm doing? tl;dr I want to populate a UI picker view with the the number range 45-550 upon the

How to customise the UIPickerView height

此生再无相见时 提交于 2019-12-21 20:28:24
问题 How to Customise the height of UIPickerView more then 250 . i have done the following but unable to get the height as given -(void)pickerview:(id)sender { pickerView=[[UIPickerView alloc] initWithFrame:CGRectMake(0,200,320,400)]; pickerView.transform = CGAffineTransformMakeScale(0.75f, 0.75f); pickerView.delegate = self; pickerView.dataSource = self; pickerView.showsSelectionIndicator = YES; pickerView.backgroundColor = [UIColor lightGrayColor]; [pickerView selectRow:1 inComponent:0 animated

How can I put an image in this UIPickerView?

自闭症网瘾萝莉.ら 提交于 2019-12-21 20:19:45
问题 I don't have any idea how can I create a custom UIPickerView with an image on the side of the text. I've been searching for a method and I just found this: - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view But I don't know how I can use that. These are my arrays: All works perfectly, I just want to put a diferent image in each row, with 10 different colors. The colors will be the same for the 3 components

UIPickerView selection indicator not visible in iOS10

爱⌒轻易说出口 提交于 2019-12-20 10:46:31
问题 I build my project in Xcode 8. UIPickerView separator lines are not visible in iOS 10 simulator and the devices, but works fine on iOS 9.3 devices and simulator. I tried to adjust the UIPickerView back ground color, auto layouts and everything possible in the XIB, but nothing works. Anyone have an idea on this? This is a custom view which contains a UIPickerView -(void)layoutSubviews{ isShown = NO; [super layoutSubviews]; //self.selectedDic = nil; self.doneBtn.tintColor = COLOR_DB3535; self

how to dismiss action sheet

删除回忆录丶 提交于 2019-12-19 16:36:20
问题 i used this code to show uipicker in uiactionsheet but when i click close button i want to remove action sheet from view. so what should be the code for removing actionSheet form view. - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField { UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:nil cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil]; [actionSheet setActionSheetStyle:UIActionSheetStyleBlackTranslucent]; CGRect pickerFrame =

UIPickerView EXC BAD ACCESS?

时光毁灭记忆、已成空白 提交于 2019-12-19 09:26:27
问题 I keep getting a exc bad access error and I think it has something to do with my UIPickerView because this is when the app crashes. Everything works fine until I make a 9th choice from the UIPickerView. Every single time the app crashes on the 9th choice. Any ideas? - (void)viewDidLoad { [super viewDidLoad]; list = [[NSMutableArray alloc] init]; [list addObject:@"Anvil"]; [list addObject:@"Apple"]; [list addObject:@"Arrow"]; [list addObject:@"Baby"]; [list addObject:@"Basketball"]; [list

How can I get a check mark beside UIPickerView labels?

浪子不回头ぞ 提交于 2019-12-18 12:33:26
问题 The UIPickerView that appears in Safari has a check mark beside the current choice. Is there a built-in way to get this, or do I have to program it up myself? If I do have to create it, can anyone point me to some code to do this? Thanks 回答1: You need to implement -pickerView:viewForRow:forComponent:reusingView: from the UIPickerViewDelegate. You have to create a view, that contains a UIButton with the checkmark image, and return it from -pickerView:viewForRow:forComponent:reusingView: 回答2:

How can I animate displaying UIPickerView after pressing button?

做~自己de王妃 提交于 2019-12-18 11:35:41
问题 I want to animate my UIPickerView after pressing the button. I already have coded my UIPickerView to be hidden on viewDidLoad and not hidden after pressing a button, but it doesn't animate like how a ModalViewController animates by default. I just want my UIPickerView to be animated just like a ModalViewController animates by default. I've researched already on the site, and on the web, but I can't seem to do it properly. Here's my code: #pragma mark - Picker View - (NSInteger

Center UIPickerView Text

﹥>﹥吖頭↗ 提交于 2019-12-18 11:06:44
问题 So I have a uipickerview with rows that only contain the number 0-24 and it looks a bit silly since the numbers are left aligned leaving a huge gap on the right of the pickerview. Is there an easy way to center align text in a uipickerview? 回答1: - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view { UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 300, 37)]; label.text = [NSString