// // TDGroupQrcodeVC.m // smartRhino // // Created by niuzhen on 2019/12/12. // Copyright © 2019 tederen. All rights reserved. // #import "TDGroupQrcodeVC.h" #import @interface TDGroupQrcodeVC () @property (weak, nonatomic) IBOutlet UIImageView *iconImgV; @property (weak, nonatomic) IBOutlet UIImageView *QRcoderV; @property (weak, nonatomic) IBOutlet UILabel *titleL; @property (weak, nonatomic) IBOutlet UILabel *nameL; @property (weak, nonatomic) IBOutlet UIButton *doneBtn; @property (weak, nonatomic) IBOutlet UIButton *backBtn; @property (weak, nonatomic) IBOutlet UIButton *menuBtn; @end @implementation TDGroupQrcodeVC +(TDGroupQrcodeVC *)initTDGroupQrcodeVC{ TDGroupQrcodeVC *controller = [StoryboardManager.shared.TDGroup instantiateViewControllerWithIdentifier:@"TDGroupQrcodeVC"]; return controller; } - (void)viewDidLoad { [super viewDidLoad]; if (self.isCreate) { self.backBtn.hidden = YES; self.menuBtn.hidden = YES; self.doneBtn.hidden = NO; }else{ self.backBtn.hidden = NO; self.menuBtn.hidden = NO; self.doneBtn.hidden = YES; } self.fd_prefersNavigationBarHidden = YES; self.view.backgroundColor = UIColorHex(#EDEDED); [self.iconImgV sd_setImageWithURL:[NSURL URLWithString:self.model.AvatarUrl] placeholderImage:kUserDefaultHeadImage]; [self.QRcoderV sd_setImageWithURL:[NSURL URLWithString:self.model.QRCoder] placeholderImage:kUserDefaultHeadImage]; self.titleL.text = self.model.Name; self.nameL.text = [NSString stringWithFormat:@"创建人:%@",self.model.UserName]; } - (IBAction)saveToPhoto:(id)sender { if(self.QRcoderV.image) { UIImageWriteToSavedPhotosAlbum(self.QRcoderV.image,self,@selector(savedPhotoImage:didFinishSavingWithError:contextInfo:),nil); }; } - (void)savedPhotoImage:(UIImage *)image didFinishSavingWithError: (NSError*)error contextInfo: (void*)contextInfo { if(error) { NSString * string = [NSString stringWithFormat:@"保存图片出错%@",error.localizedDescription]; SHOWERROR(string); } else{ SHOWSUCCESS(@"已保存到系统相册") } } - (IBAction)clickDone:(id)sender { if (self.isCreate) { [self back1]; }else{ [self.navigationController popViewControllerAnimated:YES]; } } -(void)back1{ for ( NSInteger i = (self.navigationController.viewControllers.count - 1); i > 0 ;i --) { if ([self.navigationController.viewControllers[i] isKindOfClass:NSClassFromString(@"MyTDGroupViewController")]) { [self.navigationController popToViewController:self.navigationController.viewControllers[i] animated:YES]; return; } } } @end