我使用以下代碼在圖像的開始和結尾處(50點)創建了具有額外區域的滾動視圖。使用pagingEnabled滾動時在特定位置停止UIScrollView
UIScrollView* scroll = [[UIScrollView alloc] initWithFrame: CGRectMake(0,0,200,100)];
scroll.contentSize = CGSizeMake(400,100);
UIImageView* img1 = [[UIImageView alloc] initWithFrame: CGRectMake(50,0,100,100);
UIImageView* img2 = [[UIImageView alloc] initWithFrame: CGRectMake(150,0,100,100);
UIImageView* img3 = [[UIImageView alloc] initWithFrame: CGRectMake(250,0,100,100);
//Adding images to ImageViews
scroll.pagingEnabled = YES;
[scroll addSubView:img1];
[scroll addSubView:img2];
[scroll addSubView:img3];
我第一次看到的視圖,我會看到,左邊(0-50),則附加的區域中的第一圖像(50-150),然後一半的第二圖像的(150-200 )。 當我向左滑動時,我想看到右側第一張圖像的一半,中央的第二張圖像以及右側第三張圖像的一半。
當我再次向左滑動時,我想看到第三張圖像位於中央,第二張圖像的一半位於左側,另一面位於右側。
有可能嗎?
我需要什麼滾動到滾動視圖的特定位置界定?我基本上希望每個頁面是100點,而不是200(內容寬度/框架寬度)。 – Oded 2013-05-05 09:05:22
這應該有助於http://stackoverflow.com/questions/1677085/paging-uiscrollview-in-increments-smaller-than-frame-size – Stavash 2013-05-05 09:46:29
而這個http://stackoverflow.com/questions/1220354/uiscrollview-horizontal-分頁樣的移動Safari瀏覽器選項卡 – Stavash 2013-05-05 10:23:51