【问题标题】:Auto Scroll UISCrollView to its content Position自动滚动 UISCrollView 到它的内容位置
【发布时间】:2012-11-01 11:55:40
【问题描述】:

在我的应用程序中,我有一个 UIScrollView(处于水平滚动模式)和一个按钮,当用户点击该按钮时,将在滚动视图中添加一个视图快照作为 uiimageview,我已经使用了这个,

UIGraphicsBeginImageContext(storyCreateView.frame.size);
CGContextRef context = UIGraphicsGetCurrentContext();

[storyCreateView.layer renderInContext:context];


UIImage *screenShot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext(); 


newscene.image=screenShot;
[galleryView addSubview:newscene];

当用户添加更多图像时,图像隐藏在滚动视图下我想自动滚动到右侧,以便用户能够看到他最后添加的图像。

【问题讨论】:

    标签: objective-c


    【解决方案1】:

    您可以使用 setContentOffset:animated: 。它设置与接收者原点相对应的内容视图原点的偏移量。

    希望它对你有用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-05-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-12
      相关资源
      最近更新 更多