iOS6 및 autolayout이있는 UIScrollView 내에 UITableViews를 포함하려고합니다.Autolayout이있는 UIScrollView 내의 UITableViews
나는 스트럿과 스프링이 달린 iOS 6 이전에 여러 번 만들었습니다. 적절한 프레임과 콘텐츠 크기를 설정하여 내 scrollview의 하위보기로 tableviews를 추가했습니다. 그것은 잘 작동, 사용자가 tableviews 사이를 스크롤 할 수 있지만 아이폰 5의 3.5 "화면과 4"화면 모두 더 이상 작동하지 않습니다.
스크롤보기의 높이가 올바르게 크기가 조정되지만 파단의 높이가 아니며, 그 아래 빈 공간은 4 "화면에 있습니다.
내가, IB 내의 ViewController를 만든있는 UIScrollView 추가, 나는 프로그래밍 테이블 뷰를 추가 할 수 있습니다. 나는 '시도한 방법은 프레임과 크기를 -viewDidAppear
메서드에서 설정하는 것이지만 viewcontroller가 사용자에게 제공된 후에 수정되므로 스크롤 뷰가 깜박입니다.
저는 현재 NSLayoutConstraint를 찾고 있습니다. 현재 많은 성공을 거두고 있습니다.
누구나 이미 동일한 문제가 발생 했습니까?
여기에 내 현재 코드 :
- (void)viewDidLoad
{
[super viewDidLoad];
[self composeScrollView];
}
- (void)composeScrollView {
// set up scrollview
CGSize scrollViewContentSize = _scrollView.bounds.size;
scrollViewContentSize.width *= self.tableViewsList.count;
_scrollView.contentSize = scrollViewContentSize;
CGPoint contentOffset = _scrollView.bounds.origin;
contentOffset.x = _scrollView.bounds.size.width * self.tableIndex;
_scrollView.contentOffset = contentOffset;
_scrollView.directionalLockEnabled = YES;
for (int i = 0; i < self.tableViewsList.count; i++) {
CGRect tableViewRect = _scrollView.bounds;
tableViewRect.origin.x = tableViewRect.size.width *i;
UITableView *tableView = [[UITableView alloc] initWithFrame:tableViewRect style:UITableViewStylePlain];
tableView.delegate = self;
tableView.dataSource = self;
tableView.directionalLockEnabled = YES;
[_scrollView addSubview:tableView];
}
}
나는 많은 IOS 애플 리케이션에서 레이아웃의이 종류를 보았다, 그래서 나는 해결책이 우리의 많은 도움이 될 수도있을 것 같군요.
나는 더 명료하게 사진을 추가하고 싶지만 충분한 명성이 없습니다.
http://stackoverflow.com/questions/16096021/autolayout-a-uiscrollview-to-fit-content-including-subviews-and-grouped-tables 또는 http://stackoverflow.com/questions/16699920/ios-6-autolayout-with-multiple-tableviews-all-dynamic-heights/16701733 # 16701733 너무 있습니다. – James