ユーザーがスクロールできなくてもUIScrollViewを持つことは可能ですか?したがって、プログラムでUIScrollViewをスクロールすることは可能ですか?
3065 次
2 に答える
2
はい、次のメソッドを使用してプログラムでスクロールできます。
- (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated
- (void)scrollRectToVisible:(CGRect)rect animated:(BOOL)animated
userInteractionEnabled=NO
また、ユーザータッチイベントを無効にするように設定することもできます。
于 2011-09-01T19:59:31.250 に答える
0
これを試して:
-(void)scrollViewProgramatically
{
UIScrollView *scrollview=[[UIScrollView alloc]initWithFrame:CGRectMake(x, y, 250, 150)];
scrollview.showsVerticalScrollIndicator=YES;
scrollview.scrollEnabled=YES;
scrollview.userInteractionEnabled=YES;
scrollview.backgroundColor = [UIColor whiteColor];
scrollview.contentSize = CGSizeMake(1250,250);
[scrollview addSubview:scrollview];
}
于 2013-11-19T12:17:51.397 に答える