SegmentControl不随TableView滚动而移动
问题描述:
当前正在查看的场景是“RunTestViewController”。正如你所看到的,嵌入了一个段控件。SegmentControl不随TableView滚动而移动
一切运行良好,segmentcontrol工作,但是当我滚动段控件保持放,并最终在单元格的顶部。
有没有一种方法将段控制器嵌入到tableview中,以便随表移动?
感谢,
**编辑:
------------------ **
我加入这个代码在viewDidLoad中部分:
UIView *headerView = [[UIView alloc] init ];
[headerView addSubview:resultsSegment];
self.tableView.tableHeaderView = headerView;
这允许segmentcontrol当表视图滚动,这是很大的,但是该段控制是移动现在无法点击,有什么想法?
答
你想嵌入一个视图或控件到tableview中,以便它与tableview一起滚动吗?您应该将视图或控件放入tableview标题中。
UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0,0,320,200)];
UISegmentedControl *segmentControl = [[UISegmentedControl alloc] initWithFrame:CGRectMake(0, 0, 200, 44)];
[headerView addSubview:segmentControl];
self.tableView.tableHeaderView = headerView;
是的,我想嵌入一个控件到表视图,所以它也滚动。我会给你说的去一个并回复你 – 2013-02-16 23:13:56
我已经更新了我的开幕帖子的详细信息,谢谢你的帮助 – 2013-02-16 23:20:49
如果我的回答有帮助,请你用答案选中标记来标记它吗?我花了很多时间试图回答问题以提高我的声誉。当然,如果你需要,我很高兴帮助你。 – 2013-02-16 23:35:58