ios引导页简单易用(可满足一般设计的需求)

基本上每个app都有引导页,虽然现在这种demo已经比比皆是,但感觉都不全,所以自己整理了一个,只需要传入图片,就可以正常加载出来。由于UIPageControl的小圆点大小和颜色经常与UI设计的不相符,所以后面也会提到重写类方法,进行修改。

先看下效果(图片是在网上随便找的)


Untitled.gif


把指导页图片传入guideImages中

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    NSArray* guideImages = @[@"welcomePage_1",@"welcomePage_2",@"welcomePage_3"];
    AppInstructionView* guide = [[AppInstructionView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight)];
    guide.guideImages = guideImages;
    [guide rewritePageControl];
    [self.window.rootViewController.view addSubview:guide];
    return YES;
}

如果小圆点不符合需求则在下面修改
currentColor传入当前圆点的颜色,nextColor传入其他的颜色,size表示大小

#pragma mark - 重写pageControl方法
-(void)rewritePageControl{

    _pc = [[CHPageControl alloc]initWithFrame:CGRectMake(_pageSize.width * 0.5, _pageSize.height - 50, 0,0) currentColor:COLOR(72.0, 160.0, 220.0, 1) nextColor:COLOR(99.0, 99.0, 99.0, 1) size:8];
    [_pc setBackgroundColor:[UIColor clearColor]];
    _pc.userInteractionEnabled=NO;
    [_pc setCurrentPage:0];
    [_pc setNumberOfPages:_guideImages.count];

    [self addSubview:_pc];
}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值