How to make a view with picker and toolbar stay at the bottom of iphone screen

别来无恙 提交于 2019-12-11 08:27:08

问题


I am using this code and its placing my view at the top of the viewing area instead of the bottom. Any idea what I am doing wrong? I am not creating the view in swift because I already have it created in IB with a toolbar and pickerview inside it.

let height = view.frame.size.height

yearView.frame = CGRect(x: 0, y: height - 250, width: self.view.frame.width, height: 250)

Even if I use the y coordinate and say 50 the view wont budge from the top. All I am trying to do is place this subview at the bottom of any sized phone's screen so they can select a value inside the view.


回答1:


yearView.frame = CGRect(x: 0, y: height - 250, width: self.view.frame.width, height: 250)

Try moving it out of the ViewDidLoad, you need to position that view whenever you unhide it, otherwise it will not show.



来源:https://stackoverflow.com/questions/30805669/how-to-make-a-view-with-picker-and-toolbar-stay-at-the-bottom-of-iphone-screen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!