uipickerview

UIPickerView Width in iOS8 Swift

不打扰是莪最后的温柔 提交于 2019-12-04 14:37:51
I simply can not find out how to get a width of a component on my UIPickerView. It's not allowing something simple (Int) as it needs to be CGFloat. What exactly do I put in the <#code#> section? func pickerView(pickerView: UIPickerView, widthForComponent component: Int) -> CGFloat { <#code#> } Thank you! That method doesn't "get a width of a component..." The picker view calls that method to ask you how wide a component should be. Your method could be as simple as: func pickerView(pickerView: UIPickerView, widthForComponent component: Int) -> CGFloat { return CGFloat(25.0) } (or whatever width

How to customise the UIPickerView height

核能气质少年 提交于 2019-12-04 14:22:23
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:YES]; [self.view addSubview:pickerView]; // [contentView addSubview:pickerView]; } aBilal17 Here there

iphone uipickerview : image and text

落爺英雄遲暮 提交于 2019-12-04 14:08:31
is it possible to have an image (like an icon) next to a text in UIPickerView ? I saw examples of UIPickerViews with two Columns :one that has an image and another one with the text . this is not what I need , I need to have a single column with text and Images Thanks. You will need to create your own view for each row of the picker. This is easy enough if it's just a UIImageView and a UILabel. You can then pass the view to your picker using this UIPickerViewDelegate method. - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component

make uipickerview appear between cells when touched cell

坚强是说给别人听的谎言 提交于 2019-12-04 14:05:21
I like to implement UI like this screen. as you see, when I touch a specific cell, pickerview appears at the bottom of that cell. and it sits between two cell. and pickerview doesn't seem to be a subview of cell. How do I implement this? I don't know where to start... You can insert a new cell which contains a UIPickerView when user tap on a cell by using this method - - (void)insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation Also for this you need to handle your data structure carefully by which you are populating your UITableView . You can

iOS 7 UIPickerView non-selected row curvature modification multiple components

倾然丶 夕夏残阳落幕 提交于 2019-12-04 11:10:01
问题 I am trying to modify the UIPickerView curvature to look like the iOS 7 Timer. Here is what I have: Note how the 2 and 4 are offset significantly from the 3 in the selected row. Is there a way to make it more 'flat', a la Timer in iOS7, where the 2 and 4 are directly above and below the 3? Here is what I have tried so far: Play around with - (CGFloat)pickerView:(UIPickerView *)pickerView widthForComponent:(NSInteger)component Use custom UIView and a custom UILabel offset within None seem to

Multiple pickerviews with multiple textfield inputviews Swift

梦想的初衷 提交于 2019-12-04 10:38:16
问题 I've been searching through the forum and nothing has helped. I am using 4 text fields in one view controller, and for each textfield, I am using a separate pickerView as the inputViews for the textFields (4pickers). When I click on the first textField, pickerView1 successfully appears and the textfield displays the data, however when I click on the second, third and fourth textfields,the first pickerView appears. I suspect the error lies in the inputView declarations. And I would so

How to make a UIDatePicker appear at bottom of screen?

邮差的信 提交于 2019-12-04 09:04:15
I currently use MonoTouch with MonoTouch.Dialog. When tapping on a date field it pushes the navigationcontroller so you go right a screen to see your UIDatePicker where you choose the date then go "back" to the main screen again. I'd really like to have this UI like other apps I've used that when you select a date field the UIDatePicker appears at the bottom of the current screen. I would like to learn how to do this and apply it to other input fields where I may want to use a custom picker that also presents itself at the bottom of the current screen. Does anyone have any code to share that

Manage a UIPickerView from an External Class - Using Swift

别说谁变了你拦得住时间么 提交于 2019-12-04 06:46:44
I cannot seem to find the connection to have an external class manage a view in a ViewController. I'm new to iOS and have spent considerable looking for a solution. Simple Example: Subclass of UIPickerView I create a file that is a subclass of UIPickerView and have it conform to the PickerView delegate and datasource. class MyPickerView: UIPickerView, UIPickerViewDelegate, UIPickerViewDataSource { //In here I conform to all the required methods...no problems there } Main View Controller with Outlet for the PickerView In my MainViewController, I create an outlet for my picker view. Also, in the

Programmatically Create and Show UIPickerView

妖精的绣舞 提交于 2019-12-04 05:39:48
I am attempting to create a UIPickerView programmatically and display it as the firstResponder of a textfield, however, the picker view is not showing up. textField is connected to an object in the interface builder, but pickerView is being created programatically. class View: UIViewController { @IBOutlet var picker : UIPickerView = UIPickerView.alloc() @IBOutlet var textField : UITextField = nil override func viewDidLoad() { super.viewDidLoad() picker = UIPickerView() picker.delegate = self picker.dataSource = self picker.backgroundColor = UIColor.blackColor() textField.inputView = picker } }

programmatically stop uipickerview animation on iphone

梦想与她 提交于 2019-12-04 05:19:31
I have a UIActionSheet containing a picker and a UIToolbar. On the UIToolBar there is a save button. However, some of my users reported pressing the save button before the UIPickerView stops spinning thus only retrieving the initial value (before spinning). Is there a way to get the currently selected item of the UIPickerView once the user taps save or get feedback of the active selected item while it's spinning? Thanks Even if they dismiss the picker while it's still spinning, the picker will still call the delegate with the final selected row once it stops, even if it isn't visible. Assuming