uipickerview

UIPickerView without IB?

大城市里の小女人 提交于 2019-12-12 18:18:35
问题 I have my pickerview set up and everything works fine, but right now I have that big pickerview taking up a lot of space in Interface Builder. It's annoying having to move it around when working in Interface Builder. How do I set the pickerview and it's location without using IB? 回答1: Try this: // Add the picker UIDatePicker *pickerView = [[UIDatePicker alloc] initWithFrame:CGRectMake(0,100,0,0)]; [pickerView setDatePickerMode:UIDatePickerModeTime]; [self.view addSubview:pickerView]; [self

How to prepare UIPickerView with months and years in ios?

痞子三分冷 提交于 2019-12-12 12:08:08
问题 I'm working on Preparing UIPickerView with months and year in iOS. Below is my code. in viewdidload : //Array for picker view monthsArray=[[NSMutableArray alloc]initWithObjects:@"Jan",@"Feb",@"Mar",@"Apr",@"May",@"Jun",@"Jul",@"Aug",@"Sep",@"Oct",@"Nov",@"Dec",nil]; NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setDateFormat:@"yyyy"]; NSString *yearString = [formatter stringFromDate:[NSDate date]]; yearsArray=[[NSMutableArray alloc]init]; for (int i=0; i<13; i++) {

How to realize UIPickerView with RXSwift

拥有回忆 提交于 2019-12-12 11:46:45
问题 just like UITableView items.bindTo(tableView.rx.items(cellIdentifier: "cellIdentifier", cellType: AttentionTableViewCell.self)){(row,dic,cell) in cell.configueCell(with: dic) }.addDisposableTo(dispose) 回答1: Maybe you just have to update your RxSwift library version. It looks like pretty much the same as UI{Table|Collection}View rx bindings. Supposing you have a data source like: let items: Observable<[String]> = Observable.of(["Row1", "Row2", "Row3"]) To populate your UIPickerView: items.bind

How to use UIPickerView on second ViewController

可紊 提交于 2019-12-12 10:20:00
问题 " I am creating a application for IPhone in which I have to creat a login page. after getting the response from the server..it will navigate the user to next view. in next view, i m using a UIPickerView. but it is not working.. becoz i only know that how to use it in individual app . but i dont knw how to use it in second ViewController of the application??" 回答1: You can getPicker using this -(void)getValuePicker { ViewForValuePicker = [[UIView alloc]initWithFrame:CGRectMake(0, 219, 320, 266)

How can I present a picker view just like the keyboard does?

爱⌒轻易说出口 提交于 2019-12-12 08:42:04
问题 I want a UIPickerView to show up when I press a button (just like keyboard) and then go away when user taps anywhere on the screen. How can I do this? Thanks. A bit more background: I have a UITextField called months in UITableViewCell. Now the best option for me is to put a UIPikcerView there and it will be easier for the user to just chose the month rather than having to type it out (and it's the better way). But UIPickerView looks really ugly in a UITableViewCell, not to mention I can't

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

☆樱花仙子☆ 提交于 2019-12-12 07:57:52
问题 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 回答1: 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

UIPickerView with custom views broken in iOS7

好久不见. 提交于 2019-12-12 07:49:15
问题 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? 回答1: It seems that for a strange reason, if the width of any column is higher

Set Title of UIButton from Selected Row of UIPickerView in swift

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 07:01:55
问题 I am trying to set my Button title from a selected row from uipickerview. However, I can't seem to find a valid solution. I have set the variables to be global thus I can access the Selected Variable. However I cant seem to be able to pinpoint exactly when the user clicks the exit button and able to update my button title. Things I have tried: Global Functions ( couldn't work because you cant specify the button you want to change the name of ) Dispatchqueue.main.async - Did not update my

Picker view as subview

自古美人都是妖i 提交于 2019-12-12 06:56:45
问题 i m currently working on an application and i m stuck up with the pickerview. i have a button n my view n when i click on that button i want a pickerview to appear as a sub view but i m unable to do this. i also want to select a value from the picker view and store it somewhere to use it for further actions. anyone please help.......... 回答1: Create UipickerView programatically and add it as a subview with required height using cgrectmake and delegate to self than you can select values from

Set Title of UIButton from Selected Row of UIPickerView

此生再无相见时 提交于 2019-12-12 06:28:43
问题 Detailed scenario is like this : I am creating 10 buttons using a loop and setting the tags from 0-9. On tap of each button I am calling a UIPickerView in which I am loading data from different arrays. Till here I am getting the expected results. But I want the selected row from the pickerView should set as the title of respective button. Way I tried - I stored the selected row in a NSString in the pickerViewDelegate method and trying to setTitle like : [myButton setTitle:selectedString