ios - 动态设置放置在 UIScrollView 中的 UITableView 的框架大小

标签 ios iphone uitableview swift uiscrollview

我正在使用 swift,并且有一个包含 UIViewController 的 Storyboard,其中包含 UIScrollView 和 UITableView。 storyboard hierarchy

我想要做的是在表格中加载 Excel 文件,因此我需要水平滚动。我可以设置 ScrollView 的内容大小:

scrollView.contentSize = CGSize(宽度:3500,高度:scrollView.contentSize.height)

我还需要设置 UITableView 的框架大小。当我从 Storyboard 中设置它并显示字段时,它可以工作,但是当我从 viewDidLoad 方法以编程方式设置它时,它不起作用。宽度值显示为更改为 3500,但是当我 checkin tableView cellForRowAtIndexPath 方法时,我看到 Storyboard中设置的值。

Need to change this from code

最佳答案

这是我刚刚创建的一个示例项目,看看我是否可以创建您所要求的。

https://github.com/joalbright/Excel

关于ios - 动态设置放置在 UIScrollView 中的 UITableView 的框架大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26889027/

相关文章:

ios - 无法在 Windows 的 Web 应用程序中调试 iOS 问题?

ios - UIPanGestureRecognizer translationInView 总是返回一个相对点

iphone - 无法在模态视图 Controller 上执行模态

ios - UITableViewCell 中的 UITableView 委托(delegate)和数据源

iphone - 让 UITableView 转到顶行

ios - 如何在 iOS Safari 上禁用前后缓存?

ios - Instagram 注销在 iphone 中不起作用?

iphone - 如何使 UITableView 上的单元格不可选?

iphone - 将 PhoneGap 应用程序部署到 Web 而不是 App Store

ios - 向 UISearchController 添加过滤器按钮