分页滚动视图垂直移动到
我的分页滚动视图正在水平和垂直移动,并且它应该仅水平移动。我制作了一个由 2 个视图组成的应用程序,分页滚动视图是其中一个视图的子视图,其帧为 320*400。我的分页滚动视图是 320*360 帧。我认为它只会水平移动。我粘贴了部分代码:
CGRect pagingScrollViewFrame = CGRectMake(0.0f, 0.0f, 320.0f, 480.0f);
pagingScrollView = [[UIScrollView alloc] initWithFrame:pagingScrollViewFrame];
pagingScrollView.pagingEnabled = YES;
pagingScrollView.backgroundColor = [UIColor blackColor];
pagingScrollView.showsVerticalScrollIndicator = NO;
pagingScrollView.showsHorizontalScrollIndicator = NO;
pagingScrollView.contentSize = [self contentSizeForPagingScrollView];
pagingScrollView.delegate = self;
self.view = pagingScrollView;
...
- (CGSize)contentSizeForPagingScrollView {
CGRect bounds = pagingScrollView.bounds;
return CGSizeMake(bounds.size.width * [self imageCount], bounds.size.height);
}
...
- (NSUInteger)imageCount {
static NSUInteger __count = NSNotFound;
if (__count == NSNotFound) {
__count = ([rootArray count]/5);
}
return __count;
}
谢谢
my paging scroll view is moving either horizontally and vertically and it should move only horizontally. I made an application which consists of 2 view the paging scroll view is a subview of one of them which frame is 320*400. my paging scroll view is 320*360 frame.i thought that it will move only horizontally. I pasted part of my code:
CGRect pagingScrollViewFrame = CGRectMake(0.0f, 0.0f, 320.0f, 480.0f);
pagingScrollView = [[UIScrollView alloc] initWithFrame:pagingScrollViewFrame];
pagingScrollView.pagingEnabled = YES;
pagingScrollView.backgroundColor = [UIColor blackColor];
pagingScrollView.showsVerticalScrollIndicator = NO;
pagingScrollView.showsHorizontalScrollIndicator = NO;
pagingScrollView.contentSize = [self contentSizeForPagingScrollView];
pagingScrollView.delegate = self;
self.view = pagingScrollView;
...
- (CGSize)contentSizeForPagingScrollView {
CGRect bounds = pagingScrollView.bounds;
return CGSizeMake(bounds.size.width * [self imageCount], bounds.size.height);
}
...
- (NSUInteger)imageCount {
static NSUInteger __count = NSNotFound;
if (__count == NSNotFound) {
__count = ([rootArray count]/5);
}
return __count;
}
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试添加
希望它会有所帮助
Try to add
Hope it will help