123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- //
- // ChatQrcodeVC.m
- // smartRhino
- //
- // Created by niuzhen on 2020/3/24.
- // Copyright © 2020 tederen. All rights reserved.
- //
- #import "ChatQrcodeVC.h"
- #import <Photos/Photos.h>
- @interface ChatQrcodeVC ()
- @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 ChatQrcodeVC
- +(ChatQrcodeVC *)initChatQrcodeVC{
- ChatQrcodeVC *controller = [StoryboardManager.shared.chatMsg instantiateViewControllerWithIdentifier:@"ChatQrcodeVC"];
- 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.dict[@"AvatarUrl"]] placeholderImage:kUserDefaultHeadImage];
- [self.QRcoderV sd_setImageWithURL:[NSURL URLWithString:self.dict[@"QRCoder"]] placeholderImage:kUserDefaultHeadImage];
- self.titleL.text = self.dict[@"Name"];
- self.nameL.text = [NSString stringWithFormat:@"创建人:%@",self.dict[@"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(@"TDGroupInfoListVC")]) {
- [self.navigationController popToViewController:self.navigationController.viewControllers[i] animated:YES];
- return;
- }
- }
- [self.navigationController popToRootViewControllerAnimated:YES];
- }
- @end
|