Code Monkey home page Code Monkey logo

lxfphotohelper's Introduction

LXFPhotoHelper

一行代码实现调用系统相机与相册,可配置导航栏背景与字体颜色

简书链接: iOS - 一行代码实现调用系统相机与相册,可配置导航栏背景与字体颜色

自定义样式

// 配置
LXFPhotoConfig *config = [[LXFPhotoConfig alloc] init];
config.navBarTintColor = [UIColor greenColor];
config.navBarBgColor = [UIColor purpleColor];
config.navBarTitleColor = [UIColor yellowColor];

// sourceType : 
// UIImagePickerControllerSourceTypeCamera 
// UIImagePickerControllerSourceTypePhotoLibrary 等
[[LXFPhotoHelper creatWithSourceType:sourceType config:config] getSourceWithSelectImageBlock:^(id data) {
    if ([data isKindOfClass:[UIImage class]]) { // 图片
        [self.imageView setImage:(UIImage *)data];
    } else {
        NSLog(@"所选内容非图片对象");
    }
}];

image

默认样式

默认样式可避免自定义导航栏后出现的问题(导航栏背景、标题、按键皆为白色,看不清楚)

// config 传入 nil
[[LXFPhotoHelper creatWithSourceType:sourceType config:nil] getSourceWithSelectImageBlock:^(id data) {
    if ([data isKindOfClass:[UIImage class]]) { // 图片
        [self.imageView setImage:(UIImage *)data];
    } else {
        NSLog(@"所选内容非图片对象");
    }
}];

image

lxfphotohelper's People

Contributors

linxunfeng avatar

Watchers

James Cloos avatar  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.