Coder Social home page Coder Social logo

lcnewfeature's Introduction

LCNewFeature

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

image

心有猛虎,细嗅蔷薇。

前言 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;
    }
  • 有一些神奇的地方,比如赋值只需要传一次图片名是为什么?其实是这样的,你需要按以下规范来给图片命名:(这其实是美工的事:))

    比如图片原名:`[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 上
    

更新日志 2015.11.13 Update Logs (Tag: 1.0.3)

  • 添加对 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 的图)

更新日志 2015.11.09 Update Logs (Tag: 1.0.2)

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

更新日志 2015.05.05 Update Logs (Tag: 1.0.0)

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

提示 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

Watchers

James Cloos avatar raybon.lee avatar

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.