完成ios基本功能

This commit is contained in:
zher52 2021-10-10 09:54:45 +08:00
parent 586ae7d4fe
commit d9c125bd1c

View File

@ -2,6 +2,7 @@
#import <Cordova/CDV.h>
#import "SGRecordViewController.h"
#import "SGRecordOptions.h"
@interface CapturePlugin : CDVPlugin {
// Member variables go here.
@ -10,19 +11,20 @@
- (void)capture:(CDVInvokedUrlCommand*)command;
@end
@implementation CapturePlugin
- (void)capture:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = nil;
SGRecordViewController *vc = [[SGRecordViewController alloc]init];
SGRecordOptions *options = [ SGRecordOptions createFromArguments: command];
options.commandDelegate = self.commandDelegate;
SGRecordViewController *vc = [SGRecordViewController createFromOption:options];
vc.view.frame = CGRectMake(0, 0,vc.view.frame.size.width,vc.view.frame.size.height);
// Run later to avoid the "took a long time" log message.
dispatch_async(dispatch_get_main_queue(), ^{
[self.viewController presentViewController:vc animated:YES completion:nil];
});
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
@end