This is the storyboard
I create a picker view like that ;
pickerView = UIPickerView()
pickerView.center = view.center
view.addSubview(pickerView)
pickerView.dataSource = self
pickerView.delegate = self
When i run the app picker view show up like that .
But i want the change position pickerview.How can i do that ?
If you add something programmatically(calling addSubView:) you have to do autolayout programmatically in order to position your view in correct order.
There are lots of tutorials about this.I am just giving you some example about it.Suppose if you want to put your PickerView
You have to first write below line.Why? just google it. :)
I am using anchoring.Because code is very much reduced.Thanks to Apple.
Of course you must add this after you add subView. remove this line from your code by the way.You can center align using autolayout. :)
You have to set layout constraint to change the position of pickerview as per your requirements.
if you set the below line it will show center of the view
you have to set the constraint value in respect of superview or as your required position.