From 2c3fcb1fe2272051918fc094030d01c2df989903 Mon Sep 17 00:00:00 2001 From: xuemh Date: Tue, 17 Jul 2018 22:22:09 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=9E=E6=8E=A5wifi=E9=A1=B5=E9=9D=A2UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ifish/Info.plist | 2 +- .../ConnectHotpotViewController.m | 66 +++++-- .../ConnectHotpotViewController.xib | 171 +++++++++++++++++- fastlane/Fastfile | 9 +- 4 files changed, 227 insertions(+), 21 deletions(-) diff --git a/Ifish/Info.plist b/Ifish/Info.plist index ed85e11..ca8dc54 100644 --- a/Ifish/Info.plist +++ b/Ifish/Info.plist @@ -70,7 +70,7 @@ CFBundleVersion - 484 + 485 ITSAppUsesNonExemptEncryption LSApplicationCategoryType diff --git a/Ifish/controllers/leftcontrollers/ConnectHotpotViewController.m b/Ifish/controllers/leftcontrollers/ConnectHotpotViewController.m index 03eb45b..61558bc 100644 --- a/Ifish/controllers/leftcontrollers/ConnectHotpotViewController.m +++ b/Ifish/controllers/leftcontrollers/ConnectHotpotViewController.m @@ -8,7 +8,11 @@ #import "ConnectHotpotViewController.h" -@interface ConnectHotpotViewController () +@interface ConnectHotpotViewController () +@property (weak, nonatomic) IBOutlet UIScrollView *scrollView; +@property (strong, nonatomic) IBOutletCollection(UIImageView) NSArray *dashView; +@property (weak, nonatomic) IBOutlet UITextField *pwdTf; +@property (weak, nonatomic) IBOutlet UIView *containerView; @end @@ -17,21 +21,59 @@ - (void)viewDidLoad { [super viewDidLoad]; self.title = @"热点连接"; + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keybordframeChanged:) name:UIKeyboardDidChangeFrameNotification object:nil]; + for (UIImageView *view in self.dashView) { + view.backgroundColor = [UIColor clearColor]; + view.image = [self imageWithLineWithSize:view.frame.size]; + } } -- (void)didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. +- (UIImage *)imageWithLineWithSize:(CGSize)size{ + CGFloat width = size.width; + UIGraphicsBeginImageContext(size); + CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound); + CGFloat lengths[] = {10,5}; + CGContextRef line = UIGraphicsGetCurrentContext(); + CGContextSetStrokeColorWithColor(line, [UIColor colorWithRed:133/255.0 green:133/255.0 blue:133/255.0 alpha:1.0].CGColor); + CGContextSetLineDash(line, 0, lengths, 1); + CGContextMoveToPoint(line, 0, 1); + CGContextAddLineToPoint(line, width-10, 1); + CGContextStrokePath(line); + return UIGraphicsGetImageFromCurrentImageContext(); } -/* -#pragma mark - Navigation - -// In a storyboard-based application, you will often want to do a little preparation before navigation -- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { - // Get the new view controller using [segue destinationViewController]. - // Pass the selected object to the new view controller. +- (void)dealloc { + [[NSNotificationCenter defaultCenter] removeObserver:self]; +} + +- (void)keybordframeChanged:(NSNotification *)no { + NSDictionary *userInfo = no.userInfo; + + // 动画的持续时间 + double duration = [userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue]; + + // 键盘的frame + CGRect keyboardF = [userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue]; + keyboardF = [self.view convertRect:keyboardF fromView:self.view]; + CGRect containerViewF = [self.view convertRect:self.containerView.frame fromView:self.scrollView]; + + CGFloat miniSpacing = 4; + + CGFloat offset = CGRectGetMaxY(containerViewF) + miniSpacing - CGRectGetMinY(keyboardF); + if (offset <= 0) { + offset = 0; + } + [UIView animateWithDuration:duration animations:^{ + self.scrollView.contentInset = UIEdgeInsetsMake(-offset, 0, 0, 0); + }]; +} + +#pragma mark - UITextFieldDelegate + +- (BOOL)textFieldShouldReturn:(UITextField *)textField { + [textField resignFirstResponder]; + return YES; } -*/ @end diff --git a/Ifish/controllers/leftcontrollers/ConnectHotpotViewController.xib b/Ifish/controllers/leftcontrollers/ConnectHotpotViewController.xib index 840ce83..dc2349a 100644 --- a/Ifish/controllers/leftcontrollers/ConnectHotpotViewController.xib +++ b/Ifish/controllers/leftcontrollers/ConnectHotpotViewController.xib @@ -6,19 +6,188 @@ + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 6f3d06b..938a7a4 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -18,12 +18,7 @@ default_platform(:ios) platform :ios do desc "Push a new beta build to TestFlight" lane :beta do - - ensure_git_status_clean - increment_build_number - commit_version_bump - # push_to_git_remote - # build_app(scheme: "Ifish") - # upload_to_testflight + build_app(scheme: "Ifish") + upload_to_testflight end end