嗨,我有一個問題,我的分頁滾動視圖移動horizontaly和垂直,它應該只移動horizontaly。我做了一個應用程序,其中包括2查看分頁滾動視圖是其中一個框架是320 * 400的子視圖。我的傳呼滾動視圖是320個* 360 frame.i認爲這將僅移動horizontaly.i貼上我的代碼一些部分:尋呼滾動查看移動垂直到
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;
}
感謝
這是一個可可觸摸(iOS)或可可(Mac OS X)的問題?你使用了Cocoa標籤,但是UIKit在Mac OS X上不可用,所以我認爲這是一個iOS問題。請重新登錄。 – Robin 2011-04-05 06:42:13
對不起我的錯誤可可觸摸 – Csabi 2011-04-05 06:44:19