定位 UITableViewController 视图的子视图
我将 UIView
子类添加到 UITableViewController
子类,如下所示:
[self.view addSubview:myUIView];
myUIView 的尺寸为 width = 320 和 height = 100。假设我在纵向模式下执行所有操作。当我将 myUIView 的框架设置为 CGRectMake(0, 480 - 100, 320, 100) 时,myUIView 的底部被切断。 如何设置 myUIView 的框架使其不被截断?
更新:被截断部分的高度等于状态栏的高度 +导航栏的高度。我认为 UIView
被添加到 UIScrollView
(UITableViewController
的视图是一个 UITableView
继承) UIScrollView
)向下滚动(距离等于 UIView 的截止部分)。
I'm adding a UIView
subclass to a UITableViewController
subclass like this:
[self.view addSubview:myUIView];
The dimensions of myUIView are width = 320 and height = 100. Assume I'm doing everything in portrait mode. When I set the frame of myUIView to CGRectMake(0, 480 - 100, 320, 100)
the bottom of myUIView is cut off. How can I set the frame of myUIView such that it's not cut off?
Update: The height of the cut-off portion is equal to the height of the status bar + the height of the navigation bar. I think the UIView
is being added to a UIScrollView
(the UITableViewController
's view which is a UITableView
which inherits UIScrollView
) that's scrolled down (a distance equal to the cut-off portion of the UIView).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你有状态/导航/标签栏吗?如果是这样,则需要从 480 px 屏幕高度中减去它们的高度。你也可以通过做这样的事情让事情变得更容易
Do you have a status/navigotion/tab bar? if so their height would need to be subtracted from the 480 px screen height. You could also make things easier for yourself by doing something like this