如何使用选择器和工具栏保持在iphone屏幕底部的视图 [英] How to make a view with picker and toolbar stay at the bottom of iphone screen

查看:118
本文介绍了如何使用选择器和工具栏保持在iphone屏幕底部的视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用此代码,它将我的视图放在查看区域的顶部而不是底部。知道我做错了什么吗?我没有在swift中创建视图,因为我已经在IB中创建了它,里面有工具栏和pickerview。

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)

即使我使用y坐标并说50,视图也不会从顶部移开。我所要做的就是将这个子视图放在任何大小的手机屏幕的底部,这样他们就可以在视图中选择一个值。

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.

推荐答案

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

尝试将其移出ViewDidLoad,您需要在取消隐藏它时定位该视图,否则它将无法显示。

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

这篇关于如何使用选择器和工具栏保持在iphone屏幕底部的视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆