| | |
| | | { |
| | | NSOperation *op; |
| | | BOOL _isPressed; |
| | | BOOL _landscape; // 是否旋转 |
| | | } |
| | | |
| | | @property (nonatomic) BOOL isOpenSound; |
| | |
| | | @property (weak, nonatomic) IBOutlet UILabel *streamTypeLabel; |
| | | @property (weak, nonatomic) IBOutlet UIScrollView *scrollView; |
| | | @property (weak, nonatomic) IBOutlet UILabel *zoomSizeLabel; |
| | | |
| | | @property (weak, nonatomic) IBOutlet NSLayoutConstraint *scrollViewWHRatio; // 滚动视图宽高比 |
| | | @property (nonatomic, strong) HDLEZButton *unlockButton;//开锁按钮 |
| | | |
| | | @property (nonatomic, copy) NSString *streamToken; |
| | |
| | | } |
| | | } |
| | | |
| | | - (UIInterfaceOrientationMask)supportedInterfaceOrientations |
| | | { |
| | | //- (UIInterfaceOrientationMask)supportedInterfaceOrientations |
| | | //{ |
| | | // return UIInterfaceOrientationMaskAllButUpsideDown; |
| | | //} |
| | | - (UIInterfaceOrientationMask)supportedInterfaceOrientations { |
| | | if (@available(iOS 16.0, *)) { |
| | | if (_landscape) { |
| | | //横屏 |
| | | return UIInterfaceOrientationMaskLandscape; |
| | | } else { |
| | | //竖屏 |
| | | return UIInterfaceOrientationMaskPortrait; |
| | | } |
| | | } else { |
| | | return UIInterfaceOrientationMaskAllButUpsideDown; |
| | | } |
| | | } |
| | | |
| | | - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation |
| | |
| | | self.bottomView.hidden = NO; |
| | | self.largeTitleLabel.hidden = YES; |
| | | self.localRecrodContraint.constant = 10; |
| | | |
| | | [self.scrollView setTranslatesAutoresizingMaskIntoConstraints:NO]; |
| | | [self.toolBar setTranslatesAutoresizingMaskIntoConstraints:NO]; |
| | | [NSLayoutConstraint deactivateConstraints:@[self.scrollViewWHRatio]]; |
| | | self.scrollViewWHRatio = [NSLayoutConstraint constraintWithItem:self.scrollView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.scrollView attribute:NSLayoutAttributeHeight multiplier:16/9. constant:0]; |
| | | [NSLayoutConstraint activateConstraints:@[self.scrollViewWHRatio]]; |
| | | dispatch_async(dispatch_get_main_queue(), ^{ |
| | | [self.scrollView layoutIfNeeded]; |
| | | [self.toolBar layoutIfNeeded]; |
| | | }); |
| | | |
| | | if(toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || |
| | | toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) |
| | | { |
| | |
| | | self.largeTitleLabel.hidden = NO; |
| | | self.largeBackButton.hidden = NO; |
| | | self.bottomView.hidden = YES; |
| | | |
| | | CGFloat tureScreenW = HDLEZ_APP_SCREEN_WIDTH > HDLEZ_APP_SCREEN_HEIGHT ? HDLEZ_APP_SCREEN_HEIGHT : HDLEZ_APP_SCREEN_WIDTH; |
| | | CGFloat tureScreenH = HDLEZ_APP_SCREEN_WIDTH < HDLEZ_APP_SCREEN_HEIGHT ? HDLEZ_APP_SCREEN_HEIGHT : HDLEZ_APP_SCREEN_WIDTH; |
| | | |
| | | |
| | | [self.scrollView setTranslatesAutoresizingMaskIntoConstraints:NO]; |
| | | [self.toolBar setTranslatesAutoresizingMaskIntoConstraints:NO]; |
| | | [NSLayoutConstraint deactivateConstraints:@[self.scrollViewWHRatio]]; |
| | | self.scrollViewWHRatio = [NSLayoutConstraint constraintWithItem:self.scrollView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.scrollView attribute:NSLayoutAttributeHeight multiplier:tureScreenH/tureScreenW constant:0]; |
| | | [NSLayoutConstraint activateConstraints:@[self.scrollViewWHRatio]]; |
| | | dispatch_async(dispatch_get_main_queue(), ^{ |
| | | [self.scrollView layoutIfNeeded]; |
| | | [self.toolBar layoutIfNeeded]; |
| | | }); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | - (IBAction)large:(id)sender |
| | | { |
| | | NSLog(@"######进入横屏!"); |
| | | if (@available(iOS 16.0, *)) { |
| | | _landscape = YES; |
| | | if (self.navigationController) { |
| | | dispatch_async(dispatch_get_main_queue(), ^{ |
| | | [self.navigationController setNeedsUpdateOfSupportedInterfaceOrientations]; |
| | | }); |
| | | } else { |
| | | dispatch_async(dispatch_get_main_queue(), ^{ |
| | | [self setNeedsUpdateOfSupportedInterfaceOrientations]; |
| | | }); |
| | | } |
| | | NSArray *array = [[[UIApplication sharedApplication] connectedScenes] allObjects]; |
| | | UIWindowScene *ws = (UIWindowScene *)array.firstObject; |
| | | UIWindowSceneGeometryPreferencesIOS *geometryPreferences = [[UIWindowSceneGeometryPreferencesIOS alloc] init]; |
| | | geometryPreferences.interfaceOrientations = UIInterfaceOrientationMaskLandscape; |
| | | [ws requestGeometryUpdateWithPreferences:geometryPreferences errorHandler:^(NSError * _Nonnull error) { |
| | | NSLog(@"iOS 16 Error: %@",error); |
| | | }]; |
| | | } else { |
| | | NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft]; |
| | | [[UIDevice currentDevice] setValue:value forKey:@"orientation"]; |
| | | } |
| | | } |
| | | |
| | | - (IBAction)largeBack:(id)sender |
| | | { |
| | | NSLog(@"######收回横屏!"); |
| | | if (@available(iOS 16.0, *)) { |
| | | _landscape = NO; |
| | | if (self.navigationController) { |
| | | dispatch_async(dispatch_get_main_queue(), ^{ |
| | | [self.navigationController setNeedsUpdateOfSupportedInterfaceOrientations]; |
| | | }); |
| | | } else { |
| | | dispatch_async(dispatch_get_main_queue(), ^{ |
| | | [self setNeedsUpdateOfSupportedInterfaceOrientations]; |
| | | }); |
| | | } |
| | | NSArray *array = [[[UIApplication sharedApplication] connectedScenes] allObjects]; |
| | | UIWindowScene *ws = (UIWindowScene *)array.firstObject; |
| | | UIWindowSceneGeometryPreferencesIOS *geometryPreferences = [[UIWindowSceneGeometryPreferencesIOS alloc] init]; |
| | | geometryPreferences.interfaceOrientations = UIInterfaceOrientationMaskPortrait; |
| | | [ws requestGeometryUpdateWithPreferences:geometryPreferences errorHandler:^(NSError * _Nonnull error) { |
| | | NSLog(@"iOS 16 Error: %@",error); |
| | | }]; |
| | | } else { |
| | | NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationPortrait]; |
| | | [[UIDevice currentDevice] setValue:value forKey:@"orientation"]; |
| | | } |
| | | } |
| | | |
| | | - (IBAction)capture:(id)sender |
| | | { |