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

冲突事件和横竖屏转换

作者: 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;

}

相关文章

  • 冲突事件和横竖屏转换

    一、cardGroups 界面 每个cell上盖一个同等的btn按钮,然后有左滑删除,这两个事件会有冲 突...

  • iOS 切换横竖屏

    参照:iOS强制转换横竖屏和键盘方向控制 实现点击按钮切换横竖屏的功能,设备锁屏无影响。效果如图所示: 然后,就是...

  • iOS使用Autolayout解决横竖屏控件差别较大

    iOS使用Autolayout-SizeClass解决横竖屏控件位置差别较大情况 需求: 1. 通常横竖屏转换后如...

  • [iOS] 横竖屏转换

    强制变成横屏(ARC下也可使用) 强制变回竖屏(ARC下也可使用)

  • Android监听横竖屏切换

    偶然在项目中用到播放视频时,需要横屏将视频全屏播放,所以需要监听屏幕的横竖屏切换事件。 横竖屏切换监听效果: Co...

  • iOS 横竖屏强制转换

    强制转成横屏:// 如果要上传AppStore请慎用,不知道是否能够通过,未尝试if ([[UIDevice cu...

  • iOS横竖屏转换记录

    1. 横竖屏方向枚举 关于横竖屏一共有三种枚举,UIInterfaceOrientation,UIInterfac...

  • aide安卓编程04-横竖屏设置

    在AndroidManifest.xml文件里还可以设置横屏或竖屏或自动横竖转换。 在

  • 判断“竖排锁定”是否打开

    问题来由: 由于项目需要仅支持查看图片横竖屏转换,其他界面强制竖屏。因为转换过程中【状态栏】,【导航栏】需要隐藏显...

  • iOS 横竖屏转换 强制横屏

    之前写过进入从A页面进入B页面,B页面直接进入就是横屏的情况,使用一个方法就可以了,但是昨天又遇到这个需求的时候又...

网友评论

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

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