简体   繁体   English

iOS7中UIScrollView中的UITableView

[英]UITableView in UIScrollView in iOS7

I'm working on a project which needs a paged scrollView , and each page with a tableView inside. 我正在一个项目中,它需要一个分页的scrollView ,并且每个页面中都带有tableView I'd like the tableView to handle vertical scrolling while the scrollView handles horizon scrolling. 我希望tableView可以处理垂直滚动,而scrollView处理水平滚动。

A test project on github: https://github.com/singro/Arc github上的测试项目: https//github.com/singro/Arc

It works with iOS 6, but when it comes to iOS7, It works only when the viewController is not pushed from a navigationController . 它可在iOS 6上使用,但在iOS7上,仅在未从navigationController推送viewController

some files in my project: 我项目中的一些文件:

SCMainViewController.h
SCMainViewController.m
SCSubView1.h
SCSubView1.m
SCSubView2.h
SCSubView2.m
SCViewController.h
SCViewController.m

SCViewController is VC which contains a paged scrollView & add SCSubView1 and SCSubView2 to each page. SCViewController是VC,它包含一个分页的scrollView并将SCSubView1SCSubView2添加到每个页面。

SCMainViewController is a test for navigationController with a tableView , tap of a cell will push to SCViewController . SCMainViewController是对带有tableView navigationController的测试,点击一个单元格将推送到SCViewController

Two test cases in AppDelegate: AppDelegate中的两个测试用例:

One to set SCViewController as window's rootViewController , 一种将SCViewController设置为窗口的rootViewController

Another sets a navigationController as window's rootViewController while SCMainViewController as navigationController 's rootViewController . 另一个将navigationController设置为窗口的rootViewController而将SCMainViewControllernavigationControllerrootViewController

Here is the unexpected behavior for my tableView with navigationController : 这是我的带有navigationController tableView的意外行为: 在此处输入图片说明

Figure out by add 通过添加找出

self.edgesForExtendedLayout = UIRectEdgeNone;

to SCViewController 到SCViewController

Apple docs: https://developer.apple.com/library/ios/documentation/userexperience/conceptual/TransitionGuide/AppearanceCustomization.html 苹果文档: https : //developer.apple.com/library/ios/documentation/userexperience/conceptual/TransitionGuide/AppearanceCustomization.html

Use edgesForExtendedLayout to specify which edges of a view should be extended, regardless of bar translucency. 使用barsForExtendedLayout可以指定应扩展视图的哪些边缘,而不考虑条形的透明度。 By default, the value of this property is UIRectEdgeAll. 默认情况下,此属性的值为UIRectEdgeAll。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM