【发布时间】:2013-02-28 05:46:31
【问题描述】:
我遇到了一个问题,我在底部有一个 uiview,我需要添加一些我想保持静态的标签。然后我在 uiview 顶部添加一个滚动视图,其中包含一些可滚动的内容。最后,我将原始 uiview 设置为表 headerView。尽管 contentSize 正确,但 scrollView 没有滚动。
UIView *header=[[UIView alloc]initWithFrame:CGRectMake(0, 0, 100*objects.count, 150)];
[header setBackgroundColor:[UIColor redColor]];
//set up scroll view
UIScrollView *scrollView=[[UIScrollView alloc]initWithFrame:CGRectMake(0, 20, 100*objects.count, 110)];
scrollView.delegate=self;
scrollView.contentSize=CGSizeMake(100*objects.count, scrollView.frame.size.height);
[scrollView setUserInteractionEnabled:YES];
[scrollView setScrollEnabled:YES];
[header addSubview:scrollView];
[scrollView setShowsHorizontalScrollIndicator:YES];
[self.tableView setTableHeaderView:header];
//add stuff to scroll view
但是,当我将 scrollView 设置为 tableHeaderView 时,滚动效果很好
[self.tableView setTableHeaderView:scrollView];
谁能建议我如何将原始 botton uiview 设置为标题视图并让 scrollView 仍然有效?
【问题讨论】:
-
你能发一张截图让我们更好地了解吗?
-
没什么可看的,只是滚动视图没有滚动
-
可能是边界问题。
标签: iphone xcode uitableview uiview uiscrollview