我在StoryBoard&中使用过UIPageViewcontroller。我想捏缩放UIPageViewController。
这是我的实施。请帮帮我。我是iOS的新手。
TypeA1ViewController.h
#import <UIKit/UIKit.h>
@interface TypeA1ViewController : UIPageViewController<UIPageViewControllerDataSource>
@end
TypeA1ViewController.m
#import "TypeA1ViewController.h"
#import "TypesPhotoViewController.h"
@interface TypeA1ViewController ()
{
NSArray* _imagesNames;
}
@end
@implementation TypeA1ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
_imagesNames = @[@"Type-A1.jpg",@"SpecsCDE.png" ];
self.dataSource = self;
[self setViewControllers:@[[[TypesPhotoViewController alloc] initWithImageNAme:_imagesNames[0] atIndex:0]] direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:NULL];
}
- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(TypesPhotoViewController *)viewController
{
if( viewController.pageIndex ==[_imagesNames count]-1)
{
return nil;
}
else
{
return [[TypesPhotoViewController alloc] initWithImageNAme:_imagesNames[viewController.pageIndex+1] atIndex:viewController.pageIndex+1] ;
}
}
-(UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:(TypesPhotoViewController *)viewController
{
if (viewController.pageIndex==0) {
return nil;
} else {
return [[TypesPhotoViewController alloc] initWithImageNAme:_imagesNames[viewController.pageIndex-1] atIndex:viewController.pageIndex-1];
}
}
@end