Iphone:ScrollView强制到底部
我想要一个滚动视图从底部开始。有什么办法吗 我已经试过了,但是我不能回到顶端Iphone:ScrollView强制到底部,iphone,objective-c,ios,xcode,scrollview,Iphone,Objective C,Ios,Xcode,Scrollview,我想要一个滚动视图从底部开始。有什么办法吗 我已经试过了,但是我不能回到顶端 CGPoint bottomOffset = CGPointMake(0, [yourScrollView contentSize].height); [yourScrollView setContentOffset:bottomOffset animated:YES]; 你应该打电话 CGPoint bottomOffset = CGPointMake(0, [yourScrollView contentSize
CGPoint bottomOffset = CGPointMake(0, [yourScrollView contentSize].height);
[yourScrollView setContentOffset:bottomOffset animated:YES];
你应该打电话
CGPoint bottomOffset = CGPointMake(0, [yourScrollView contentSize].height);
[yourScrollView setContentOffset:bottomOffset animated:NO];
在viewDidLoad中。并检查yourScrollView
它应该正确连接到它的IBOutlet,或者从[self.view view with tag:]接收在尝试更改contentOffset
之前,code>和contentSize
应设置为UIScrollView
内容大小
顺便说一句,要使它从一开始就处于底部,你应该设置动画:否,我想你必须使用
[self.catScroll scrollRectToVisible:CGRectMake(fr.frame.origin.x,0 , self.catScroll.frame.size.width, self.catScroll.frame.size.height) animated:NO];
其中catScroll
是scrollView
或者使用setContentOffset:
在scrollView
的委托方法ScrollViewDiEndDecreating:
中将此属性更改为新的contentoffset
我想这肯定会对你有帮助
快乐编码:)这里我使用了水平滚动,所以我设置了它的帧原点x查看答案的第一行只需在您的案例中放置您希望可见的帧只需放置CGRectMake(0,高度滚动视图的高度、宽度、高度中的内容大小)将其放置为scrollRectToVisible:我找到了!非常感谢你!