美文网首页
iOS -- ImageScrollView的使用

iOS -- ImageScrollView的使用

作者: 井底蛙之呱呱 | 来源:发表于2017-11-06 20:19 被阅读84次

第三方资料联系qq:577109832

1.首先我们创建GuideViewController
2.导入头文件

#import "ImageScrollView.h"
#import "AppDelegate.h"
//添加协议ImageScrollViewDelegate
- (void)viewDidLoad {
    [super viewDidLoad];
    // 这里是将图片添加到数组
    NSArray *arr = @[@"guidePage1",@"guidePage2",@"guidePage3"];
    //初始化并调用方法
    /*
initWithFrame:self.view.frame设置滚动视图位置
style:ImageScrollType_Guide设置类型为引导页视图
images:arr添加图片数组
confirmBtnTitle:@"立即体验" 按钮的标题
confirmBtnTitleColor:[UIColor whiteColor]标题颜色
confirmBtnFrame:CGRectMake(FIT_X(260), FIT_Y(30), FIT_X(120), FIT_Y(40))按钮的位置
autoScrollTimeInterval:0.0滚动时间间隔
delegate:self代理
*/
    ImageScrollView *imgScrView = [[ImageScrollView alloc]initWithFrame:self.view.frame style:ImageScrollType_Guide images:arr confirmBtnTitle:@"立即体验" confirmBtnTitleColor:[UIColor whiteColor] confirmBtnFrame:CGRectMake(FIT_X(260), FIT_Y(30), FIT_X(120), FIT_Y(40)) autoScrollTimeInterval:0.0 delegate:self];
    [self.view addSubview:imgScrView];
    //添加pageControl
    [imgScrView addPageControlToSuperView:self.view];
    
}
#pragma mark -ImageScrollViewDelegate
- (void)experienceDidHandle{
    //获取当前的版本号,持久化
    NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
    [ud setObject:VERSION_CURRENT forKey:NOT_FIRST_LANUCH];
    [ud synchronize];
    
    //切换窗口的根视图控制器
    AppDelegate *app = (AppDelegate *)[UIApplication sharedApplication].delegate;
    //app.window.rootViewController = app.sideMenu;
    
}

相关文章

网友评论

      本文标题:iOS -- ImageScrollView的使用

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