diff --git a/.DS_Store b/.DS_Store index 3647ef0..eda25fc 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/Ifish.xcodeproj/project.pbxproj b/Ifish.xcodeproj/project.pbxproj index fe453e5..27c777a 100644 --- a/Ifish.xcodeproj/project.pbxproj +++ b/Ifish.xcodeproj/project.pbxproj @@ -15777,7 +15777,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 4; DEVELOPMENT_TEAM = WFX8GD5HFX; ENABLE_BITCODE = NO; ENABLE_TESTABILITY = YES; @@ -15895,7 +15895,7 @@ CODE_SIGN_IDENTITY = "iPhone Distribution"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; CODE_SIGN_STYLE = Manual; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 4; DEVELOPMENT_TEAM = WFX8GD5HFX; ENABLE_BITCODE = NO; ENABLE_TESTABILITY = YES; diff --git a/Ifish/Common/CommonUtils.h b/Ifish/Common/CommonUtils.h index 37d9ead..bcf8b3c 100644 --- a/Ifish/Common/CommonUtils.h +++ b/Ifish/Common/CommonUtils.h @@ -159,4 +159,6 @@ typedef enum{ + (NSString *)getRandomStringWithNum:(NSInteger)num; CGAffineTransform GetCGAffineTransformRotateAroundPoint(float centerX, float centerY ,float x ,float y ,float angle); ++ (void)interfaceOrientation:(UIInterfaceOrientation)orientation; ++ (UIBarButtonItem*)ItemWithTitle:(NSString *)title target:(id)target action:(SEL)action titleColor:(UIColor*)titleColor; @end diff --git a/Ifish/Common/CommonUtils.m b/Ifish/Common/CommonUtils.m index e5a2e23..88e4f8a 100644 --- a/Ifish/Common/CommonUtils.m +++ b/Ifish/Common/CommonUtils.m @@ -287,6 +287,31 @@ return timeString; } ++ (void)interfaceOrientation:(UIInterfaceOrientation)orientation +{ + if ([[UIDevice currentDevice] respondsToSelector:@selector(setOrientation:)]) { + SEL selector = NSSelectorFromString(@"setOrientation:"); + NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[UIDevice instanceMethodSignatureForSelector:selector]]; + [invocation setSelector:selector]; + [invocation setTarget:[UIDevice currentDevice]]; + int val = orientation; + // 从2开始是因为0 1 两个参数已经被selector和target占用 + [invocation setArgument:&val atIndex:2]; + [invocation invoke]; + } +} ++ (UIBarButtonItem*)ItemWithTitle:(NSString *)title target:(id)target action:(SEL)action titleColor:(UIColor*)titleColor +{ + UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; + if(title.length) [button setTitle:title forState:UIControlStateNormal]; + button.titleLabel.font = [UIFont systemFontOfSize:16]; + if (titleColor==nil) titleColor = [UIColor whiteColor]; + [button setTitleColor:titleColor forState:UIControlStateNormal]; + [button setTitleColor:[UIColor lightGrayColor] forState:UIControlStateDisabled]; + [button sizeToFit]; + [button addTarget:target action:action forControlEvents:UIControlEventTouchUpInside]; + return [[UIBarButtonItem alloc] initWithCustomView:button]; +} + (NSDictionary *)getSSIDInfo { NSArray *interfaceNames = CFBridgingRelease(CNCopySupportedInterfaces()); diff --git a/Ifish/controllers/BaseVIewContorller/BaseViewController.m b/Ifish/controllers/BaseVIewContorller/BaseViewController.m index ee5526b..f17b149 100644 --- a/Ifish/controllers/BaseVIewContorller/BaseViewController.m +++ b/Ifish/controllers/BaseVIewContorller/BaseViewController.m @@ -131,15 +131,6 @@ // #ifdef IOS6 -- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation -{ - return UIInterfaceOrientationLandscapeRight; -} - -- (BOOL)shouldAutorotate { - return NO; -} - - (NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskLandscapeRight; } diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishP2PPlayBack/IfishPlaybackViewCell.m b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishP2PPlayBack/IfishPlaybackViewCell.m index ca32e09..3fe7805 100644 --- a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishP2PPlayBack/IfishPlaybackViewCell.m +++ b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishP2PPlayBack/IfishPlaybackViewCell.m @@ -28,20 +28,21 @@ NSString*start=[NSString stringWithFormat:@"%ld%02ld%02ld%02ld%02ld",model.year,model.month,model.day,model.hour,model.minute]; NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; - formatter.dateFormat = @"yyyyMMddHHmm"; - NSDate*date=[formatter dateFromString:start]; + formatter.dateFormat = @"yyyyMMddHHmmss"; + NSDate*date=model.date; + if (!date + ) { + date= [formatter dateFromString:[start stringByAppendingFormat:@"%02ld",model.second]]; + + } NSString*end=[NSString stringWithFormat:@"%ld%02ld%02ld%02ld%02ld",model.year,model.month,model.day,model.hour,model.minute]; if (date) { - if ([model.cType isEqualToString:@"S"]) - { - date=[date dateByAddingTimeInterval:model.time]; - } - else - { - date=[date dateByAddingTimeInterval:model.time*60]; - } + + date=[date dateByAddingTimeInterval:model.time]; + + formatter.dateFormat=@"yyyyMMddHHmm"; end=[formatter stringFromDate:date]; } else diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishP2PPlayBack/PlayBackViewController.m b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishP2PPlayBack/PlayBackViewController.m index 1e12f95..364cce4 100644 --- a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishP2PPlayBack/PlayBackViewController.m +++ b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishP2PPlayBack/PlayBackViewController.m @@ -17,17 +17,29 @@ - (void)viewDidLoad { [super viewDidLoad]; -// NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; -// formatter.dateFormat = @"yyyy-MM-dd HH:mm"; -// -// NSString *string = [formatter stringFromDate:self.model.date]; // + self.navigationController.navigationBar.hidden=YES; + [[UIApplication sharedApplication] setStatusBarHidden:YES]; + [AppDelegate sharedDefault].canFullScreen = YES; [self setTitleString:@"视频回放"]; + UIBarButtonItem*bat=[CommonUtils ItemWithTitle:@"切换" target:self action:@selector(varyOritation) titleColor:[UIColor whiteColor]]; + self.navigationItem.rightBarButtonItems=nil; + self.navigationItem.rightBarButtonItem=bat; self.view.backgroundColor=[UIColor blackColor]; + UITapGestureRecognizer*tap=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(taptochange)]; + + [self.view addGestureRecognizer:tap]; + [CommonUtils interfaceOrientation:UIDeviceOrientationLandscapeRight]; [self connectDevice]; // Do any additional setup after loading the view from its nib. } + +-(void)viewDidLayoutSubviews +{ + [super viewDidLayoutSubviews]; + +} -(void)playFiles { //添加播放器VC @@ -37,6 +49,7 @@ self.player.mute = YES; self.player.delegate=self; self.player.viewController.view.backgroundColor = [UIColor clearColor]; + self.player.viewController.view.autoresizingMask=UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight; self.player.viewController.view.frame=self.playView.bounds; [self addChildViewController:self.player.viewController]; @@ -54,6 +67,11 @@ [weakSelf.view makeToast:@"连接失败请重试!"]; weakSelf.retryBtn.hidden=NO; + [AppDelegate sharedDefault].canFullScreen = NO; + + + [CommonUtils interfaceOrientation:UIDeviceOrientationPortrait]; + }); @@ -119,5 +137,79 @@ self.player=nil; [self connectDevice]; } +-(void)taptochange +{ + self.navigationController.navigationBar.hidden=!self.navigationController.navigationBar.hidden; + [[UIApplication sharedApplication] setStatusBarHidden:self.navigationController.navigationBar.isHidden]; +} + +-(void)dealloc +{ + self.navigationController.navigationBar.hidden=NO; + [[UIApplication sharedApplication] setStatusBarHidden:NO]; + [AppDelegate sharedDefault].canFullScreen = NO; + [CommonUtils interfaceOrientation:UIInterfaceOrientationPortrait]; +} + +-(UIInterfaceOrientationMask)supportedInterfaceOrientations{ + + return UIInterfaceOrientationMaskAll; +} + +#pragma mark 一开始希望的屏幕方向 +-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{ + return UIDeviceOrientationLandscapeRight; +} + +#pragma mark - 屏幕旋转 +-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration +{ + + + if (toInterfaceOrientation == UIInterfaceOrientationPortrait) + { + + } + else if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft) { + + } + else if (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) + { + + + } +} +-(BOOL)shouldAutorotate +{ + return YES;; +} +-(BOOL)prefersStatusBarHidden + +{ + return self.navigationController.isNavigationBarHidden; + +} + + +-(void)varyOritation +{ + UIInterfaceOrientation statusBarOrientation = [UIApplication sharedApplication].statusBarOrientation; + if (statusBarOrientation==UIInterfaceOrientationPortrait) + { + [AppDelegate sharedDefault].canFullScreen = YES; + + [CommonUtils interfaceOrientation:UIDeviceOrientationLandscapeRight]; + } + else + { + [AppDelegate sharedDefault].canFullScreen = NO; + + + [CommonUtils interfaceOrientation:UIDeviceOrientationPortrait]; + + + } + +} @end diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishP2PPlayBack/PlayBackViewController.xib b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishP2PPlayBack/PlayBackViewController.xib index b704393..faeaeaf 100644 --- a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishP2PPlayBack/PlayBackViewController.xib +++ b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishP2PPlayBack/PlayBackViewController.xib @@ -36,7 +36,7 @@ - +