From 3e8437ae559487362fae3525beb79c534c213a51 Mon Sep 17 00:00:00 2001 From: 单军华 Date: Thu, 12 Jul 2018 13:44:34 +0800 Subject: [PATCH] bug修复和功能优化 --- screendisplay/screendisplay/Classes/Main/LMJMessageViewController.m | 110 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 110 insertions(+), 0 deletions(-) diff --git a/screendisplay/screendisplay/Classes/Main/LMJMessageViewController.m b/screendisplay/screendisplay/Classes/Main/LMJMessageViewController.m new file mode 100755 index 0000000..21b7074 --- /dev/null +++ b/screendisplay/screendisplay/Classes/Main/LMJMessageViewController.m @@ -0,0 +1,110 @@ +// +// LMJMessageViewController.m +// PLMMPRJK +// +// Created by windshan on 2017/4/6. +// Copyright �� 2017��� GoMePrjk. All rights reserved. +// + +#import "LMJMessageViewController.h" +//#import "BSJTabBarController.h" +//#import "SINTabBarController.h" +//#import "IMHTabBarController.h" +//#import "MUSHomeListViewController.h" +//#import "VIDTabBarController.h" + +@interface LMJMessageViewController () +/** <#digest#> */ +@property (weak, nonatomic) UILabel *backBtn; +@end + +@implementation LMJMessageViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + TWWeak(self); + NSLog(@"%@", weakself); + self.navigationItem.title = @"������������"; + + UIEdgeInsets edgeInsets = self.tableView.contentInset; + edgeInsets.bottom += self.tabBarController.tabBar.lmj_height; + self.tableView.contentInset = edgeInsets; + +} + +- (void)viewDidAppear:(BOOL)animated { + [super viewDidAppear:animated]; + self.backBtn.hidden = !self.presentedViewController; +} + +- (void)viewDidDisappear:(BOOL)animated { + [super viewDidDisappear:animated]; + self.backBtn.hidden = !self.presentedViewController; +} + +- (UILabel *)backBtn +{ + if(_backBtn == nil) + { + UILabel *btn = [[UILabel alloc] init]; + btn.text = @"������������"; + btn.font = AdaptedFontSize(10); + btn.textColor = [UIColor whiteColor]; + btn.backgroundColor = [UIColor colorWithWhite:0.000 alpha:0.700];; + btn.textAlignment = NSTextAlignmentCenter; + btn.userInteractionEnabled = YES; + [btn sizeToFit]; + [btn setFrame:CGRectMake(20, 100, btn.lmj_width + 20, 30)]; + btn.layer.cornerRadius = 15; + btn.layer.masksToBounds = YES; + + TWWeak(self); + [btn addTapGestureRecognizer:^(UITapGestureRecognizer *recognizer, NSString *gestureId) { + + if (weakself.presentedViewController) { + [weakself.presentedViewController dismissViewControllerAnimated:YES completion:nil]; + } + + }]; + + + TWWeak(btn); + [btn addGestureRecognizer:[[UIPanGestureRecognizer alloc] initWithActionBlock:^(UIPanGestureRecognizer *_Nonnull sender) { + +// NSLog(@"%@", sender); + + // ������������������������ + // CGPoint curP = [pan locationInView:self.imageView]; + + // ������������ + // ��������������������������������������������������������� + CGPoint transP = [sender translationInView:weakbtn]; + + weakbtn.transform = CGAffineTransformTranslate(weakbtn.transform, transP.x, transP.y); + + // ������ + [sender setTranslation:CGPointZero inView:weakbtn]; + + if (sender.state == UIGestureRecognizerStateEnded) { + + [UIView animateWithDuration:0.2 animations:^{ + + weakbtn.lmj_x = (weakbtn.lmj_x - kScreenWidth / 2) > 0 ? (kScreenWidth - weakbtn.lmj_width - 20) : 20; + weakbtn.lmj_y = weakbtn.lmj_y > 80 ? weakbtn.lmj_y : 80; + }]; + } + + }]]; + + + + [[UIApplication sharedApplication].keyWindow addSubview:btn]; + + _backBtn = btn; + } + return _backBtn; +} + + + +@end -- Gitblit v1.8.0