系統SDK介紹 02

2021-09-24 07:10:43 字數 3398 閱讀 5235

開啟相簿選擇

開啟相機拍攝

在info.plist檔案中新增需要的許可權

相簿許可權:privacy - photo library usage description 允許此許可權才能使用系統相簿。

麥克風許可權:privacy - microphone usage description 獲取麥克風許可權不然會崩,只有允許此許可權才能錄音。

#pragma mark - 許可權判斷

- (bool)authorizationcamera

return

true;

}複製**

typedef ns_enum(nsinteger, lzsystemphotoselectortype) ;

typedef ns_enum(nsinteger, lzsystemopendevicetype) ;

複製**

#import 

ns_assume_nonnull_begin

typedef ns_enum(nsinteger, lzsystemphotoselectortype) ;

typedef ns_enum(nsinteger, lzsystemopendevicetype) ;

@inte***ce lzsystemphotoselector : nsobject

+ (instancetype)selector;

/** @param type 型別

@param allowsediting 是否允許編輯

*/- (void)lz_openablumwithtype:(lzsystemphotoselectortype)type allowsediting:(bool)allowsediting resultfile:(void(^)(id info))resultfile;

/** 開啟相機或攝像機

@param type 型別

@param allowsediting 是否拍攝完成進行編輯

*/- (void)lz_opendevicewithtype:(lzsystemopendevicetype)type allowsediting:(bool)allowsediting resultfile:(void(^)(id info))resultfile;

@end

ns_assume_nonnull_end

複製**

#import "lzsystemphotoselector.h"

#import

#import

#import

#import

@inte***ce lzsystemphotoselector () @property (nonatomic, copy) void (^resultfile)(id info);

@property (nonatomic, assign) bool allowsediting;

@end

@implementation lzsystemphotoselector

+ (instancetype)selector );

return selector;

}- (void)lz_openablumwithtype:(lzsystemphotoselectortype)type allowsediting:(bool)allowsediting resultfile:(void(^)(id info))resultfile

self.allowsediting = allowsediting;

self.resultfile = resultfile;

uiimagepickercontroller *controller = [[uiimagepickercontroller alloc] init];

controller.delegate = self;

controller.sourcetype = uiimagepickercontrollersourcetypephotolibrary;

if (type == lzsystemphotoselectortypephoto) else

controller.allowsediting = allowsediting;

[krootviewcontroller presentviewcontroller:controller animated:true completion:nil];

}#pragma mark - 開啟相機或攝像機

- (void)lz_opendevicewithtype:(lzsystemopendevicetype)type allowsediting:(bool)allowsediting resultfile:(void (^)(id _nonnull))resultfile

if (![self authorizationcamera])

self.allowsediting = allowsediting;

self.resultfile = resultfile;

uiimagepickercontroller *controller = [[uiimagepickercontroller alloc] init];

controller.delegate = self;

controller.sourcetype = uiimagepickercontrollersourcetypecamera;

if (type == lzsystemopendevicetypecamera) else

controller.allowsediting = allowsediting;

[krootviewcontroller presentviewcontroller:controller animated:true completion:nil];

}#pragma mark - uiimagepickercontrollerdelegate

- (void)imagepickercontroller:(uiimagepickercontroller *)picker didfinishpickingmediawithinfo:(nsdictionary*)info else

} else

[picker dismissviewcontrolleranimated:true completion:nil];

}- (void)imagepickercontrollerdidcancel:(uiimagepickercontroller *)picker

#pragma mark - 許可權判斷

- (bool)authorizationcamera

return

true;

}@end

複製**

一文介紹SDK

1 sdk的概念 sdk即 軟體開發工具包 軟體開發工具包一般都是一些軟體工程師為特定的軟體包 軟體框架 硬體平台 作業系統等建立應用軟體時的開發工具的集合。簡單講,就是通過第三方服務商實現產品功能的軟體工具包。通常,sdk會由專業的公司提供專業的服務的集合,比如移動支付技術 語音識別技術 我們公司...

02 基本動畫的介紹

1 建立乙個最基本的動畫,然後往y軸做乙個移動,當執行動畫的時候,真正移動的不是layer本身,而是presentation tree,當動畫移動的時候,會把原始塗層隱藏,動畫完成後,就會把presentation圖層移除,原始塗層就會顯示,所以動畫會恢復成原來的狀態 void touchesbeg...

02WAB入門 介紹

wab內建了許多theme。1.billboard布告欄主題 該theme擁有所有themes裡面最多的布局,但是沒有包含widget控制器。所有的widget都是直接展示,它適合於簡單任務。2.box框主題 將所有的widgets都集中在了框控制器中。預設情況下,所有的直接顯示widget都關閉。...