2011-04-05 43 views
0

嗨,我有一個問題,我的分頁滾動視圖移動horizo​​ntaly和垂直,它應該只移動horizo​​ntaly。我做了一個應用程序,其中包括2查看分頁滾動視圖是其中一個框架是320 * 400的子視圖。我的傳呼滾動視圖是320個* 360 frame.i認爲這將僅移動horizo​​ntaly.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; 
    } 

感謝

+0

這是一個可可觸摸(iOS)或可可(Mac OS X)的問題?你使用了Cocoa標籤,但是UIKit在Mac OS X上不可用,所以我認爲這是一個iOS問題。請重新登錄。 – Robin 2011-04-05 06:42:13

+0

對不起我的錯誤可可觸摸 – Csabi 2011-04-05 06:44:19

回答

1

嘗試添加

pagingScrollViewFrame.scrollsToTop=NO; 

希望它會幫助

+0

接近pagingScrollView.scrollsToTop = NO;我發現在contentSizeForPagingScrollView bounds.size.height讓我回到480,我需要360,所以我只是改變它,它的工作,但thx的答案 – Csabi 2011-04-05 07:04:48