TDGroupQrcodeVC.m 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. //
  2. // TDGroupQrcodeVC.m
  3. // smartRhino
  4. //
  5. // Created by niuzhen on 2019/12/12.
  6. // Copyright © 2019 tederen. All rights reserved.
  7. //
  8. #import "TDGroupQrcodeVC.h"
  9. #import <Photos/Photos.h>
  10. @interface TDGroupQrcodeVC ()
  11. @property (weak, nonatomic) IBOutlet UIImageView *iconImgV;
  12. @property (weak, nonatomic) IBOutlet UIImageView *QRcoderV;
  13. @property (weak, nonatomic) IBOutlet UILabel *titleL;
  14. @property (weak, nonatomic) IBOutlet UILabel *nameL;
  15. @property (weak, nonatomic) IBOutlet UIButton *doneBtn;
  16. @property (weak, nonatomic) IBOutlet UIButton *backBtn;
  17. @property (weak, nonatomic) IBOutlet UIButton *menuBtn;
  18. @end
  19. @implementation TDGroupQrcodeVC
  20. +(TDGroupQrcodeVC *)initTDGroupQrcodeVC{
  21. TDGroupQrcodeVC *controller = [StoryboardManager.shared.TDGroup instantiateViewControllerWithIdentifier:@"TDGroupQrcodeVC"];
  22. return controller;
  23. }
  24. - (void)viewDidLoad {
  25. [super viewDidLoad];
  26. if (self.isCreate) {
  27. self.backBtn.hidden = YES;
  28. self.menuBtn.hidden = YES;
  29. self.doneBtn.hidden = NO;
  30. }else{
  31. self.backBtn.hidden = NO;
  32. self.menuBtn.hidden = NO;
  33. self.doneBtn.hidden = YES;
  34. }
  35. self.fd_prefersNavigationBarHidden = YES;
  36. self.view.backgroundColor = UIColorHex(#EDEDED);
  37. [self.iconImgV sd_setImageWithURL:[NSURL URLWithString:self.model.AvatarUrl] placeholderImage:kUserDefaultHeadImage];
  38. [self.QRcoderV sd_setImageWithURL:[NSURL URLWithString:self.model.QRCoder] placeholderImage:kUserDefaultHeadImage];
  39. self.titleL.text = self.model.Name;
  40. self.nameL.text = [NSString stringWithFormat:@"创建人:%@",self.model.UserName];
  41. }
  42. - (IBAction)saveToPhoto:(id)sender {
  43. if(self.QRcoderV.image) {
  44. UIImageWriteToSavedPhotosAlbum(self.QRcoderV.image,self,@selector(savedPhotoImage:didFinishSavingWithError:contextInfo:),nil);
  45. };
  46. }
  47. - (void)savedPhotoImage:(UIImage *)image didFinishSavingWithError: (NSError*)error contextInfo: (void*)contextInfo
  48. {
  49. if(error) {
  50. NSString * string = [NSString stringWithFormat:@"保存图片出错%@",error.localizedDescription];
  51. SHOWERROR(string);
  52. }
  53. else{
  54. SHOWSUCCESS(@"已保存到系统相册")
  55. }
  56. }
  57. - (IBAction)clickDone:(id)sender {
  58. if (self.isCreate) {
  59. [self back1];
  60. }else{
  61. [self.navigationController popViewControllerAnimated:YES];
  62. }
  63. }
  64. -(void)back1{
  65. for ( NSInteger i = (self.navigationController.viewControllers.count - 1); i > 0 ;i --) {
  66. if ([self.navigationController.viewControllers[i] isKindOfClass:NSClassFromString(@"MyTDGroupViewController")]) {
  67. [self.navigationController popToViewController:self.navigationController.viewControllers[i] animated:YES];
  68. return;
  69. }
  70. }
  71. }
  72. @end