2016-08-30 67 views
0

我正在研究iPhone應用程序,其中我有5-6套圖像。我想使用頁面捲曲動畫(例如iBook)更改圖像,用戶可以按頁面捲曲動畫的手指移動來滑動頁面。我想要在iPhone上實現相同的動畫..有什麼辦法可以不使用私有庫或UIPageViewController或者如果有任何樣本可以實現這一點?iOS上的iBook圖像捲曲動畫

除了谷歌搜索我得到某種libaries如:

paperstack

XBPagecurl

pagecurling

沒有得到太多的幫助。

+0

看到這個http://www.iostute.com/2015/04/how-to-implement-partial-and-full-page.html –

+0

感謝庵埠。我已經看過它。但是這是通過點擊具有預定義動畫持續時間和時間的按鈕而發生的。我希望按照用戶在iBooks應用程序中實現的手指移動來使用此功能。 –

+0

定製你的自我添加代碼的手勢多數民衆贊成在所有 –

回答

0

請不要去確切的解決方案,上面的解決方案會給你一些想法,你可以在這方面的工作,並擴大它。這樣你學得越多,玩的越多。我有建議的博客,請通過它探索它。在你看來像這樣

UISwipeGestureRecognizer *gesture = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(curlAnimation)]; 
[gesture setDirection:UISwipeGestureRecognizerDirectionLeft]; 
[self.view1 addGestureRecognizer:gesture]; 

Implement partial and full page curl animation in iOS app

1

添加滑動手勢使用下面的代碼片段

- (void)curlAnimation 
{ 
    [UIView animateWithDuration:1.0 
        animations:^{ 
         CATransition * animation = [CATransition animation]; 
         [animation setDelegate:self]; 
         [animation setDuration:1.2f]; 
         animation.startProgress = 0.0; 
         animation.endProgress = 1; 
         [animation setTimingFunction:UIViewAnimationCurveEaseInOut]; 
         [animation setType:@"pageCurl"]; 
         [animation setSubtype:@"fromRight"]; 
         [animation setRemovedOnCompletion:NO]; 
         [animation setFillMode: @"extended"]; 
         [animation setRemovedOnCompletion: NO]; 
         [[self.view1 layer] addAnimation:animation 
                  forKey:@"pageFlipAnimation"]; 
        } 
    ]; 
} 

可以代替設置「fromLeft」使捲曲動畫fromRight in this method [animation setSubtype:@"fromRight"]用於從左至右動畫

enter image description here

編碼快樂..