Giter VIP home page Giter VIP logo

lcnewfeature's Introduction

LCNewFeature

Travis CocoaPods CocoaPods CocoaPods LeoDev

几行代码快速集成新特性界面!

LCNewFeature

In me the tiger sniffs the rose.

心有猛虎,细嗅蔷薇。

欢迎访问 我的博客 ~

前言 Foreword

每次拿到一个项目的时候,头疼的几件事之一就是新特性界面,写一堆代码做一个简单的东西。所以抽空写了个快速集成新特性界面的框架,传了上来共享之~

代码 Code

  • 下面是示例代码,请多参考Demo!!

  • 两种集成方法任选一:

    • 方法一:CocoaPods 导入:pod 'LCNewFeature'
    • 方法二:在Demo中找到 LCNewFeature 文件夹,拖拽到你的项目中。
  • AppDelegate.m 文件中,导入头文件:#import "LCNewFeature.h",参考下列代码快速集成:

    BOOL showNewFeature = [LCNewFeatureVC shouldShowNewFeature];
    
    if (showNewFeature) {   // 如果需要显示新特性界面
    
        __weak typeof(self) weakSelf = self;
        LCNewFeatureVC *newFeatureVC = [LCNewFeatureVC newFeatureWithImageName:@"new_feature"
                                                                    imageCount:3
                                                                showPageControl:YES
                                                                    finishBlock:^{
    
                                                                        [weakSelf enterMainVC];
                                                                    }];
    
        self.window.rootViewController = newFeatureVC;
    
    } else {    // 如果不需要显示新特性界面
    
        [self enterMainVC];
    }
  • enterMainVC (进入主界面) 方法参考:

    - (void)enterMainVC {
    
        UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    
        self.window.rootViewController = storyboard.instantiateInitialViewController;
    }
  • 回调当前页码的 delegate:(@optional)

    // 当前页码的代理
    newFeatureVC.delegate = self;
    
    // ...
    
    #pragma mark - LCNewFeatureVC Delegate
    
    - (void)newFeatureVC:(LCNewFeatureVC *)newFeatureVC page:(NSInteger)page {
        NSLog(@"%@ -> Page: %d", newFeatureVC, (int)page);
    }
  • 有一些神奇的地方,比如赋值只需要传一次图片名是为什么?其实是这样的,你需要按以下规范来给图片命名:(这其实是美工的事:))

    比如图片原名:`[email protected]`
    
    规范:
    `[email protected]`   将作为第一张图展示
    `[email protected]`   将作为第二张图展示
    ...
    
  • 那么怎么适配不同尺寸的屏幕呢?简单,不用动代码,还是规范图片命名:(这还是美工的事:))

    比如图片原名:`[email protected]`
    
    规范:
    `[email protected]`           将展示在 iPhone 4 / 4s 上
    `[email protected]`   将展示在 iPhone 5 / 5s 上
    `[email protected]`   将展示在 iPhone 6 / 6s 上
    `[email protected]`  将展示在 iPhone 6 p / 6s p 上
    

版本 Release

V 1.1.3 (2016.05.03)

  • 去除 Log。

V 1.1.2 (2016.04.22)

  • 添加代理协议,回调当前页码。详见 Issue 5

V 1.1.1 (2016.04.05)

  • 更新 CocoaPods 源地址。

V 1.1.0 (2016.03.23)

  • 添加跳过按钮。

    __weak typeof(self) weakSelf = self;
    
    newFeatureVC.showSkip = YES;
    newFeatureVC.skipBlock = ^(void) {
        [weakSelf enterMainVC]; // 进入首页
    };

V 1.0.3 (2015.12.07)

  • Demo 中添加演示:切换 RootVC 时,如何搞淡入淡出效果。😈😈

V 1.0.3 (2015.11.13)

  • 添加对 iPhone 6 / 6s / 6 p / 6s p 的放大模式的支持,感谢 RobinChao 等同学的提醒。

  • 已针对放大模式进行了显示测试和边框校对,例:Demo 中的 iPhone 6 / 6s 第一张启动图。(根目录下有个 PSD 文件,参考修改)附:放大模式下屏幕分辨率:

    • iPhone 6 / 6s 的放大模式下,屏幕分辨率为:640 x 1136 (框架将使用 iPhone 5 的图)
    • iPhone 6 p / 6s p 的放大模式下,屏幕分辨率为:1125 x 2001 (框架将使用 iPhone 6 p 的图)

V 1.0.2 (2015.11.09)

  • 添加对 CocoaPods 的支持:pod 'LCNewFeature'

V 1.0.0 (2015.05.05)

  • 初始化提交。

  • 添加一些界面跳转的动画效果。

提示 Tips

  • 提供了两种进入主界面的方式:

    + (instancetype)newFeatureWithImageName:(NSString *)imageName imageCount:(NSInteger)imageCount showPageControl:(BOOL)showPageControl finishBlock:(finishBlock)finishBlock;
        将通过一直左划的方式,通过block回调进入主界面。
    + (instancetype)newFeatureWithImageName:(NSString *)imageName imageCount:(NSInteger)imageCount showPageControl:(BOOL)showPageControl enterButton:(UIButton *)enterButton;
        将在最后一张新特性图片上添加一个按钮,然后点击按钮进入主界面,按钮的属性设置好再传入(参考Demo中的代码)。
  • 上述方法都是类方法,也提供了实例方法 initWith... 什么的,视个人习惯调用。

  • 提供了一些属性,可选设置:

    • 当前点(分页控制器)的颜色:pointCurrentColor
    • 其他点(分页控制器)的颜色:pointOtherColor
    • 状态栏样式:statusBarStyle
  • 记住一句话:经理可以顶,职位可以辞,但是服务器的哥们和美工的妹子绝对不能惹!2333

  • 多参考 Demo,如果还有问题或者建议,请联系我,我也想做的更好!联系方式在下面:)

联系 Support

授权 License

本项目采用 MIT license 开源,你可以利用采用该协议的代码做任何事情,只需要继续继承 MIT 协议即可。

lcnewfeature's People

Contributors

itofu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

lcnewfeature's Issues

shouldShowNewFeature里的版本判断是不是有问题

这个方法里是分别获取沙盒中版本号和当前的版本号,如果版本号相同,则返回NO表示不显示引导界面;如果不同,则显示引导界面
这难道不就意味着:只要每次升级版本,都会显示这个引导页面——我觉得应该没有这个必要,更可取的是:只有重大版本升级时,才显示引导页面

适配iPad

如果我想适配iPad,我新特性图片的iPad图片怎么命名呀

enterButton

enterButton 只能设置一个吗?建议可以自定义,满足不同的跳转需求

iphone X 的图片名称没做吧

建议可以根据屏幕宽高比来,不用每一种设备都搞一套。
可以加个属性: 是否AspectFill
如果是,则一套就够,imgView 的 contentMode全部采用AspectFill,不同设备,会有适当裁剪,告诉设计作图时,边缘留足够空就行。
如果否,则根据屏幕宽高比来就行,目前对iPhone来说3套就够了,iPhone 5 6 6p,都是16:9,缩放不变形。iPad的项目需要单独处理,应该都是3:4。

320:480 2:3
640:1136 9:16
750:1334 9:16
1242:2208 9:16
1125:2436 9:19.5

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.