如何将UITableView正确放置在视图顶部的固定点上 [英] How to position a UITableView correctly at a fixed point from the top of the view

查看:37
本文介绍了如何将UITableView正确放置在视图顶部的固定点上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 UITableView 放置在视图顶部的200个点处.我可以使用以下代码来做到这一点.我的问题是最后一行的一半不滚动并且被遮盖/隐藏.

I'm trying to position a UITableView 200 points from the top of the view. I'm able to do that with the following code. The problem I have is that half of the last row doesn't scroll and is obscured/hidden.

如何更改此行 self.mainTableView.frame = CGRectMake(0,200,320,600);,以便表正确地在视图的底部结束,并调整大小以使所有行在视图内完全滚动.

How can I change this line self.mainTableView.frame = CGRectMake(0,200,320,600); so that the table ends at the bottom of the view correctly and is sized so that all rows scroll fully within the view.

感谢您的帮助

self.mainTableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
self.mainTableView.frame = CGRectMake(0,200,320,600);
self.mainTableView.autoresizingMask = ( UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth );
self.mainTableView.dataSource = self;
self.mainTableView.delegate = self;

推荐答案

编写以下代码,可能对您有帮助:

Write Following code, Its Might be helpful in your case:

self.mainTableView.frame = CGRectMake(0,200,320,self.view.frame.size.height-200);

这篇关于如何将UITableView正确放置在视图顶部的固定点上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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