→ tracetw: view的constraint沒設好? 12/07 13:21
因為當初autolayout一直拉不滿意,最後是用code做layout...
-(void)viewDidLayoutSubviews{
[super viewDidLayoutSubviews];
[self.theScrollView setFrame:CGRectMake(30, 100,
[[UIScreen mainScreen] bounds].size.width -60,
[[UIScreen mainScreen] bounds].size.height -200)];
[self.theView setFrame:CGRectMake(0, 0,
self.theScrollView.frame.size.width, 440)];
self.theScrollView.contentSize =
CGSizeMake([[UIScreen mainScreen] bounds].size.width -60, 440);
}
scrollview 上下100 左右30, view左右同scrollview 上下固定440
剛剛我又測了一下,
- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
NSLog(@"y = %f",scrollView.contentOffset.y);
}
正常滑動的話y會一直跑,在拉到最底時y=160 (6s)
但是拉到最底時點上面任一個TextField或UIButton會抓到y=0
※ 編輯: ZMTL (111.83.231.184), 12/07/2015 13:45:09
→ cryinglove: UITableView 看起來比較適合你的需求 12/07 22:16