Coder Social home page Coder Social logo

chenxing640 / clang_api Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 1.0 190 KB

clang_api封装 iOS 系统常用接口,存取bundle中的资源,读取本地化文本,执行选择器和 UserDefaults 的相关操作,调用通知中心的相关操作等。

License: Other

Objective-C 96.38% Ruby 3.62%
objective-c c api api-client api-wrapper ios pod cocoapods

clang_api's Introduction

如果能帮助到你,请你给一颗星,谢谢!(If this can help you, please give it a star, Thanks!)

clang_api

存取bundle中的资源,读取本地化文本,执行选择器和UserDefaults的相关操作,调用通知中心的相关操作等。

License MIT  CocoaPods  CocoaPods 

Group (ID:614799921)

Installation

Using CocoaPods:

 pod 'clang_api'

Or

 pod 'clang_api', '~> 1.1.2'

Usage

  • 获取Bundle资源文件路径
NSString *path = clang_path_for_resource_from_bundle(@"Info", @"plist", nil, @"Test");
NSLog(@"Info.plist's path: %@", path);
NSLog(@"Info.plist's content: %@", [NSDictionary dictionaryWithContentsOfFile:path]);
  • 获取Bundle中的图片
UIImage *image = clang_load_image_from_bundle(@"angle-mask", @"angle-mask.bundle", @"Test");
NSLog(@"Image: %@", image);
  • 获取Bundle中的图片,不缓存内存
UIImage *image2 = clang_image_with_contents_of_file(@"angle-mask", nil, @"angle-mask.bundle", @"Test");
NSLog(@"Image2: %@", image2);
  • 获取Main Bundle中的资源文件路径
NSString *path2 = clang_path_for_resource_from_bundle(@"Info", @"plist", nil, nil);
NSLog(@"info.plist's path2: %@", path2);
NSLog(@"info.plist's content2: %@", [NSDictionary dictionaryWithContentsOfFile:path2]);
  • 获取Main Bundle中的图片,不缓存内存
UIImage *Image3 = clang_image_with_contents_of_file(@"angle-mask", nil, nil, nil);
NSLog(@"Image3: %@", image3);
  • 读取本地化内容
NSLog(@"Localized string: %@", clang_localized_string(@"Lan_network_timeout", nil, @"en", @"language", @"Test"));
  • 其他
BOOL y1 = clang_equal(@1, @3);
//NSLog(@"y1: %d", y1);
BOOL y2 = clang_equal_to_string(@"try", @"try");
//NSLog(@"y2: %d", y2);

clang_perform_selector(self, @selector(run));
clang_perform_selector_v2(self, @selector(runWithArg:), @10);
clang_delay_perform_selector(self, @selector(update), 1.0);
clang_delay_perform_selector_v2(self, @selector(updateWithArg:), @"update", 1.0);
    
clang_store_object(@"AppID", @"g7482293", YES);
NSString *appID = clang_read_object(@"AppID");
//NSLog(@"appID: %@", appID);
//clang_remove_object(@"AppID", YES);
    
clang_add_observer(self, @selector(logInWithResult:), @"kLoginNotification", nil);
//clang_remove_observer_v2(self, @"kLoginNotification", nil);
//clang_remove_observer(self);
clang_post_notification_name(@"kLoginNotification", @1);
clang_post_notification_name_v2(@"kLoginNotification", nil, @{@"ret": @0});

Sample

clang_api's People

Contributors

itenfay avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

lgq2015

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.