123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- //
- // ViewController.m
- // Demo
- //
- // Created by lr on 2023/2/1.
- //
- #import "ViewController.h"
- #import <AVFoundation/AVFoundation.h>
- #import <Photos/Photos.h>
- #import <Masonry/Masonry.h>
- #import <MobileCoreServices/MobileCoreServices.h>
- //#import "LenzTensorFlow.h"
- #import <LenzCameraNativeModuleForRN/PCSBaseViewController.h>
- @interface ViewController ()<UIImagePickerControllerDelegate,UINavigationControllerDelegate>
- @property (nonatomic) UIImagePickerController *imagePickerVc;
- @property (nonatomic) UIButton *takeButton;
- //@property (nonatomic) LenzTensorFlow *tensor;
- @property (nonatomic) UILabel *resultLabel;
- @property (nonatomic) UILabel *remakeLabel;
- @property (nonatomic) UITextView *textView;
- @property (nonatomic) UIButton *photoButton;
- @end
- @implementation ViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- [self.navigationController setNavigationBarHidden:YES animated:NO];
- self.view.backgroundColor = [UIColor whiteColor];
-
-
- self.photoButton = [[UIButton alloc]init];
- self.photoButton.backgroundColor = [UIColor grayColor];
- [self.photoButton setTitle:@"打开相机" forState:UIControlStateNormal];
- [self.photoButton addTarget:self action:@selector(photoAction) forControlEvents:UIControlEventTouchUpInside];
- [self.view addSubview:self.photoButton];
- [self.photoButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.mas_equalTo(self.view);
- make.bottom.mas_offset(-80);
- make.width.mas_offset(80);
- make.height.mas_offset(44);
- }];
-
- self.textView = [[UITextView alloc]init];
- self.textView.backgroundColor = [UIColor lightGrayColor];
- [self.view addSubview:self.textView];
- [self.textView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_offset(20);
- make.right.mas_offset(-20);
- make.top.mas_offset(50);
- make.bottom.mas_equalTo(self.photoButton.mas_top).mas_offset(-50);
- }];
-
- }
- - (void)photoAction {
- self.textView.text = nil;
- NSMutableDictionary *dict = [NSMutableDictionary dictionary];
- dict[@"dataRetainedMode"] = @"retain";
- dict[@"cameraMode"] = @[@"continuous",@"single",@"video", @"panorama", @"panoramaPlus"];
- dict[@"flashMode"] = @"auto";
- dict[@"type"] = @"back";
- dict[@"videoQuality"] = @(720);
- dict[@"recTime"] = @(10);
- dict[@"keyframe"] = @(1);
- PCSBaseViewController *vc = [PCSBaseViewController initWithParams:dict complete:^(NSDictionary * _Nonnull dict) {
- NSError *error;
- NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dict
- options:NSJSONWritingSortedKeys
- error:&error];
- NSString *jsonString;
- if (!jsonData) {
- NSLog(@"%@",error);
- } else {
- jsonString = [[NSString alloc]initWithData:jsonData encoding:NSUTF8StringEncoding];
- }
-
- }];
- [self presentViewController:vc animated:YES completion:nil];
- }
- @end
|