美文网首页
iOS上类似驾考宝典覆盖翻页的控件SZPageControlle

iOS上类似驾考宝典覆盖翻页的控件SZPageControlle

作者: 蹦擦擦我勒个去 | 来源:发表于2017-05-14 12:54 被阅读0次

    SZPageController是仿UITableView接口所实现的类似于驾考宝典覆盖翻页,小说阅读器覆盖翻页效果的一个控件,支持cocoapods导入,接口简单易用。

    github地址:https://github.com/StenpZ/SZPagecontroller

    示例:

    @interfaceViewController()

    @property(nonatomic,weak)SZPageController*pageController;

    @end

    @implementationViewController

    - (void)viewDidLoad {

    [superviewDidLoad];

    self.view.backgroundColor= [UIColorwhiteColor];

    SZPageController*pageVC = [[SZPageControlleralloc]init];

    pageVC.dataSource=self;

    pageVC.delegate=self;

    pageVC.circleSwitchEnabled=NO;

    //pageVC.contentModeController = NO;

    //pageVC.switchToLastEnabled = NO;

    //pageVC.switchSlideEnabled = NO;

    //pageVC.switchTapEnabled = NO;

    [self.viewaddSubview:pageVC.view];

    [selfaddChildViewController:pageVC];

    self.pageController= pageVC;

    [self.pageControllerreloadData];

    //if ([self.pageController canSwitchToIndex:12]) {

    //[self.pageController switchToIndex:12 animated:YES];

    //}

    }

    #pragma mark - SZPageControllerDelegate

    - (NSInteger)numberOfPagesInPageController:(SZPageController*)pageController {

    return10;

    }

    - (UIViewController*)pageController:(SZPageController*)pageController controllerForIndex:(NSInteger)index {

    TempViewController*vc = [[TempViewControlleralloc]init];

    vc.view.backgroundColor=ViewColor;

    vc.textLabel.text= [NSStringstringWithFormat:@"%ld", (long)index];

    returnvc;

    }

    - (UIView*)pageController:(SZPageController*)pageController viewForIndex:(NSInteger)index {

    TempView*view = [[TempViewalloc]init];

    view.backgroundColor=ViewColor;

    view.textLabel.text= [NSStringstringWithFormat:@"%ld", (long)index];

    returnview;

    }

    - (void)pageController:(SZPageController*)pageController currentController:(UIViewController*)currentController currentIndex:(NSInteger)currentIndex {

    NSLog(@"%@ __ %ld", currentController, currentIndex);

    }

    - (void)pageController:(SZPageController*)pageController currentView:(UIView*)currentView currentIndex:(NSInteger)currentIndex {

    NSLog(@"%@ __ %ld", currentView, currentIndex);

    }

    - (void)pageControllerDidSwitchToFirst:(SZPageController*)pageController {

    NSLog(@"第一个");

    }

    - (void)pageControllerDidSwitchToLast:(SZPageController*)pageController {

    NSLog(@"最后一个");

    }

    - (void)pageControllerSwitchToLastDisabled:(SZPageController*)pageController {

    NSLog(@"不能再向前了");

    }

    - (void)pageControllerSwitchToNextDisabled:(SZPageController*)pageController {

    NSLog(@"不能再向后了");

    }

    详细使用请参照示例程序

    相关文章

      网友评论

          本文标题:iOS上类似驾考宝典覆盖翻页的控件SZPageControlle

          本文链接:https://www.haomeiwen.com/subject/xzkqxxtx.html