如何修復屏幕上的子視圖位置(特別是在UIScrollView和UITableView中)?我認爲在故事板iOS:在屏幕上添加具有修復位置的子視圖
[self.view addSubview:aSubView];
不工作了。
任何想法?
編輯#1:我使用UITableViewController,而不是一個簡單的UITableView。
EDIT#2:
CGRect fixedFrame = self.menuViewRelative.frame;
fixedFrame.origin.y = 0 + scrollView.contentOffset.y;
self.menuViewRelative.frame = fixedFrame;
menuViewRelative = [[UIView alloc] init];
menuViewRelative.backgroundColor = [UIColor grayColor];
menuViewRelative.frame = CGRectMake(0.0, 0.0, 320.0, 50.0);
[self.view addSubview:self.menuViewRelative];
請充實你的問題有點....我不明白你想要做什麼。 –
在ios 6中你可以在xib中使用約束 – samfisher
我想修復一個子視圖(UIView)的位置,所以它不會與UITableView的內容一起滾動。子視圖應該保持固定在屏幕上.. – filou