UIScrollView 和 PageControl:视图之间的空间
是否可以在 UIScrollView 和 PageControl 显示的视图之间添加一些黑色空间。每个视图都是一个简单的视图控制器,其中包含一个 UiImageView,类似于相册。我想添加空间,因此当用户切换“页面”/照片时,之间存在一些间隙。
scrollArea.pagingEnabled = YES;
scrollArea.contentSize = CGSizeMake(scrollArea.frame.size.width * [photos count], scrollArea.frame.size.height);
scrollArea.showsHorizontalScrollIndicator = NO;
scrollArea.showsVerticalScrollIndicator = NO;
scrollArea.scrollsToTop = NO;
scrollArea.delegate = self;
我不想让图像变小,但这就可以了。有什么想法吗?
Is it possible to add some black space between views that are shown by a UIScrollView and PageControl. Each of these views is a simple view controller with an UiImageView in it, similar to the photo album. I want to add the space, so when the users are switching "pages"/photos, there is some gap in between.
scrollArea.pagingEnabled = YES;
scrollArea.contentSize = CGSizeMake(scrollArea.frame.size.width * [photos count], scrollArea.frame.size.height);
scrollArea.showsHorizontalScrollIndicator = NO;
scrollArea.showsVerticalScrollIndicator = NO;
scrollArea.scrollsToTop = NO;
scrollArea.delegate = self;
I wouldn't want to make the images smaller, but that would do the trick. Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,您可以完全控制 UIScrollView 内所有 UIView 的放置以及页面控件相对于滚动视图的放置。没有完成自动布局,您需要正确设置所有对象的框架属性,以便它们“很好”地适合滚动视图的“页面”(可见区域=一个“页面”)
这是一个添加的示例内容到滚动视图中每个页面内特定 x,y 处的多个“页面”:
Yes, you have full control over placement of all UIViews inside of the UIScrollView and the placement of the page control in relation to the scrollview. There is no automatic layout done, it's up to you to properly set the frame property of all the objects so that they fit "nicely" within the "page" of the scrollview (visible area = one "page")
Here's an example off adding content to multiple "pages" in a scrollview at a particular x,y within each page: