MyQRCodeVC.m 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. //
  2. // MyQRCodeVC.m
  3. // smartRhino
  4. //
  5. // Created by armin on 2019/11/1.
  6. // Copyright © 2019 tederen. All rights reserved.
  7. //
  8. #import "MyQRCodeVC.h"
  9. #import <Photos/Photos.h>
  10. #import "NoteBookShareVC.h"
  11. #import "CreateNoteBookVC.h"
  12. @interface MyQRCodeVC ()<NoteBookShareVCDelegate>
  13. @property (strong,nonatomic) IBOutlet UIView *showContentBgView;
  14. @property (strong,nonatomic) IBOutlet UIButton *shareBtn;
  15. @property (strong,nonatomic) IBOutlet UIButton *backBtn;
  16. @property (strong,nonatomic) IBOutlet UIImageView *qrCodeImg;
  17. @property (strong, nonatomic) NoteBookShareVC *noteBookShareVC;
  18. @end
  19. @implementation MyQRCodeVC
  20. +(MyQRCodeVC *)initMyQRCodeVC{
  21. MyQRCodeVC *controller = [StoryboardManager.shared.myCenter instantiateViewControllerWithIdentifier:@"MyQRCodeVC"];
  22. return controller;
  23. }
  24. - (void)viewDidLoad {
  25. [super viewDidLoad];
  26. self.fd_prefersNavigationBarHidden = YES;
  27. self.showContentBgView.layer.masksToBounds = YES;
  28. self.showContentBgView.layer.cornerRadius = 5.0;
  29. UILongPressGestureRecognizer *longPressGesture =[[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(headerLongPress:)];
  30. [self.showContentBgView addGestureRecognizer:longPressGesture];
  31. WS(weakSelf);
  32. [self.backBtn setAction:^{
  33. [weakSelf.navigationController popViewControllerAnimated:YES];
  34. }];
  35. [self.qrCodeImg setImageWithURL:[NSURL URLWithString:[AppUserModel sharedAppUserModel].QRCoder] placeholder:IMG(@"zhujun")];
  36. [self.shareBtn setAction:^{
  37. [weakSelf.noteBookShareVC initNoteBookShareData];
  38. weakSelf.noteBookShareVC.view.hidden = !weakSelf.noteBookShareVC.view.hidden;
  39. }];
  40. [self.view addSubview:self.noteBookShareVC.view];
  41. }
  42. - (NoteBookShareVC *)noteBookShareVC{
  43. if (_noteBookShareVC == nil) {
  44. _noteBookShareVC = [NoteBookShareVC initNoteBookShareVC];
  45. [_noteBookShareVC.view setFrame:CGRectMake(0,0, SCREEN_WIDTH, SCREEN_HEIGHT)];
  46. [_noteBookShareVC.view setHidden:YES];
  47. _noteBookShareVC.delegate = self;
  48. }
  49. return _noteBookShareVC;
  50. }
  51. -(void)userSelectType:(NSString *)typeName WithIndexPath:(NSIndexPath *)indexPath{
  52. self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
  53. if ([typeName isEqualToString:@"发给微信好友"]) {
  54. }else if ([typeName isEqualToString:@"发到朋友圈"]){
  55. }else if ([typeName isEqualToString:@"发到微博"]){
  56. }else if ([typeName isEqualToString:@"发给QQ好友"]){
  57. }else if ([typeName isEqualToString:@"发到消息"]){
  58. }else if ([typeName isEqualToString:@"发到小组"]){
  59. }else if ([typeName isEqualToString:@"发到笔记"]){
  60. CreateNoteBookVC *vc = [CreateNoteBookVC initCreateNoteBookVC];
  61. vc.createNoteBookType = CreateNoteBookType_MyCode;
  62. vc.shareModel.imageUrl = [AppUserModel sharedAppUserModel].QRCoder;
  63. vc.shareModel.FileName = @"MyCode";
  64. vc.shareModel.FileId = 0;
  65. vc.shareModel.type = CollectDataType_IMG;
  66. vc.shareModel.title = @"";
  67. vc.shareModel.content = @"";
  68. [self.navigationController pushViewController:vc animated:YES];
  69. }else if ([typeName isEqualToString:@"发到话题"]){
  70. }else{
  71. }
  72. }
  73. /**
  74. * 长按
  75. */
  76. -(void)headerLongPress:(UILongPressGestureRecognizer *)longRecognizer{
  77. if (longRecognizer.state == UIGestureRecognizerStateBegan) {
  78. WS(weakSelf);
  79. NSError *error = nil;
  80. [[PHPhotoLibrary sharedPhotoLibrary] performChangesAndWait:^{
  81. [PHAssetChangeRequest creationRequestForAssetFromImage:weakSelf.qrCodeImg.image];
  82. } error:&error];
  83. if(error){
  84. [ShowtipTool showMessageWithStatus:@"保存失败"];
  85. }else{
  86. [ShowtipTool showMessageWithStatus:@"保存成功"];
  87. }
  88. }
  89. }
  90. /*
  91. #pragma mark - Navigation
  92. // In a storyboard-based application, you will often want to do a little preparation before navigation
  93. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  94. // Get the new view controller using [segue destinationViewController].
  95. // Pass the selected object to the new view controller.
  96. }
  97. */
  98. @end