美文网首页
冲突事件和横竖屏转换

冲突事件和横竖屏转换

作者: ErinCaptain | 来源:发表于2016-12-29 19:43 被阅读0次

    一、cardGroups 界面 

          每个cell上盖一个同等的btn按钮,然后有左滑删除,这两个事件会有冲   突。 把cell上的button改为手势 就解决了这个问题。。

    二、 UIViewController的转屏方法 ,调整控件的frame:

    - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{

    if (toInterfaceOrientation == UIInterfaceOrientationPortrait) {

    self.view.backgroundColor = [UIColor whiteColor];

    [self.playerView mas_updateConstraints:^(MASConstraintMaker *make) {

    make.top.equalTo(self.view).offset(0);

    }];

    if (m_imageView) {

    [m_imageView setFrame:CGRectMake(0, 0, screen, screen*9/16.0)];

    [bottomImageView setFrame:CGRectMake(0, m_imageView.height-50, m_imageView.width, 50)];

    [textLabel setFrame:CGRectMake(0, 0, bottomImageView.width, 50)];

    }

    if(backViewB){

    [backViewB setFrame:CGRectMake(0, 0, screen, screen*9/16.0)];

    [photoView setFrame:CGRectMake(0, 0, backViewB.frame.size.width, backViewB.frame.size.height)];

    _playButton.frame = CGRectMake(screen/2-40, screen*9/16.0*9/16-65, 80, 80);

    }

    }else if (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight || toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft) {

    self.view.backgroundColor = [UIColor blackColor];

    }

    三、设置这个项目哪些页面支持自动转屏

             设置整个app支持方向;

            MyNavigationViewController 继承UINavigationController

    - (void)viewDidLoad {

    [super viewDidLoad];

    // Do any additional setup after loading the view.

    //设置默认导航字体颜色

    [self.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor colorWithHexString:@""],NSForegroundColorAttributeName,nil]];

    }

    // 哪些页面支持自动转屏

    -(BOOL)shouldAutorotate{

    if ([self.viewControllers.lastObject.class isSubclassOfClass:[VideoViewController class]] ) {

    return ![ZFPlayerSingleton sharedZFPlayer].isLockScreen;

    }else if ([self.viewControllers.lastObject.class isSubclassOfClass:[VodViewController class]]){

    return ![ZFPlayerSingleton sharedZFPlayer].isLockScreen;

    }

    return NO;

    }

    // viewcontroller支持哪些转屏方向

    -(UIInterfaceOrientationMask)supportedInterfaceOrientations{

    if ([self.viewControllers.lastObject.class isSubclassOfClass:[VideoViewController class]]) {

    return UIInterfaceOrientationMaskAll;

    }else if ([self.viewControllers.lastObject.class isSubclassOfClass:[VodViewController class]]){

    return UIInterfaceOrientationMaskAll;

    }

    return UIInterfaceOrientationMaskPortrait;

    }

    相关文章

      网友评论

          本文标题:冲突事件和横竖屏转换

          本文链接:https://www.haomeiwen.com/subject/hcypvttx.html