123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- //
- // MyQRCodeVC.m
- // smartRhino
- //
- // Created by armin on 2019/11/1.
- // Copyright © 2019 tederen. All rights reserved.
- //
- #import "MyQRCodeVC.h"
- #import <Photos/Photos.h>
- #import "NoteBookShareVC.h"
- #import "CreateNoteBookVC.h"
- @interface MyQRCodeVC ()<NoteBookShareVCDelegate>
- @property (strong,nonatomic) IBOutlet UIView *showContentBgView;
- @property (strong,nonatomic) IBOutlet UIButton *shareBtn;
- @property (strong,nonatomic) IBOutlet UIButton *backBtn;
- @property (strong,nonatomic) IBOutlet UIImageView *qrCodeImg;
- @property (strong, nonatomic) NoteBookShareVC *noteBookShareVC;
- @end
- @implementation MyQRCodeVC
- +(MyQRCodeVC *)initMyQRCodeVC{
- MyQRCodeVC *controller = [StoryboardManager.shared.myCenter instantiateViewControllerWithIdentifier:@"MyQRCodeVC"];
- return controller;
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.fd_prefersNavigationBarHidden = YES;
-
- self.showContentBgView.layer.masksToBounds = YES;
- self.showContentBgView.layer.cornerRadius = 5.0;
-
- UILongPressGestureRecognizer *longPressGesture =[[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(headerLongPress:)];
- [self.showContentBgView addGestureRecognizer:longPressGesture];
-
- WS(weakSelf);
- [self.backBtn setAction:^{
- [weakSelf.navigationController popViewControllerAnimated:YES];
- }];
-
- [self.qrCodeImg setImageWithURL:[NSURL URLWithString:[AppUserModel sharedAppUserModel].QRCoder] placeholder:IMG(@"zhujun")];
- [self.shareBtn setAction:^{
- [weakSelf.noteBookShareVC initNoteBookShareData];
- weakSelf.noteBookShareVC.view.hidden = !weakSelf.noteBookShareVC.view.hidden;
- }];
- [self.view addSubview:self.noteBookShareVC.view];
- }
- - (NoteBookShareVC *)noteBookShareVC{
- if (_noteBookShareVC == nil) {
- _noteBookShareVC = [NoteBookShareVC initNoteBookShareVC];
- [_noteBookShareVC.view setFrame:CGRectMake(0,0, SCREEN_WIDTH, SCREEN_HEIGHT)];
- [_noteBookShareVC.view setHidden:YES];
- _noteBookShareVC.delegate = self;
- }
- return _noteBookShareVC;
- }
- -(void)userSelectType:(NSString *)typeName WithIndexPath:(NSIndexPath *)indexPath{
- self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
- if ([typeName isEqualToString:@"发给微信好友"]) {
-
- }else if ([typeName isEqualToString:@"发到朋友圈"]){
-
- }else if ([typeName isEqualToString:@"发到微博"]){
-
- }else if ([typeName isEqualToString:@"发给QQ好友"]){
-
- }else if ([typeName isEqualToString:@"发到消息"]){
-
- }else if ([typeName isEqualToString:@"发到小组"]){
-
- }else if ([typeName isEqualToString:@"发到笔记"]){
- CreateNoteBookVC *vc = [CreateNoteBookVC initCreateNoteBookVC];
- vc.createNoteBookType = CreateNoteBookType_MyCode;
- vc.shareModel.imageUrl = [AppUserModel sharedAppUserModel].QRCoder;
- vc.shareModel.FileName = @"MyCode";
- vc.shareModel.FileId = 0;
- vc.shareModel.type = CollectDataType_IMG;
- vc.shareModel.title = @"";
- vc.shareModel.content = @"";
- [self.navigationController pushViewController:vc animated:YES];
- }else if ([typeName isEqualToString:@"发到话题"]){
-
- }else{
-
- }
- }
- /**
- * 长按
- */
- -(void)headerLongPress:(UILongPressGestureRecognizer *)longRecognizer{
- if (longRecognizer.state == UIGestureRecognizerStateBegan) {
- WS(weakSelf);
- NSError *error = nil;
- [[PHPhotoLibrary sharedPhotoLibrary] performChangesAndWait:^{
- [PHAssetChangeRequest creationRequestForAssetFromImage:weakSelf.qrCodeImg.image];
- } error:&error];
- if(error){
- [ShowtipTool showMessageWithStatus:@"保存失败"];
- }else{
- [ShowtipTool showMessageWithStatus:@"保存成功"];
- }
- }
- }
- /*
- #pragma mark - Navigation
- // In a storyboard-based application, you will often want to do a little preparation before navigation
- - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
- // Get the new view controller using [segue destinationViewController].
- // Pass the selected object to the new view controller.
- }
- */
- @end
|