冲突事件和横竖屏转换

一、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;

}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 1、禁止手机睡眠[UIApplication sharedApplication].idleTimerDisabl...
    DingGa阅读 4,814评论 1 6
  • 1、设置UILabel行间距 NSMutableAttributedString* attrString = [[...
    十年一品温如言1008阅读 5,870评论 0 3
  • 1、设置UILabel行间距 NSMutableAttributedString* attrString = [[...
    FF_911阅读 5,272评论 0 3
  • 我想我的心很远,要想出去走走逛逛看看。我喜欢看风景,可以一个人,一整天,但我依旧记得要回家,得回家。 或许当初还太...
    Siti_Chen会疯阅读 2,187评论 0 1
  • “啊,又做了那个奇怪的梦啊,到底那个人是谁?”安沐揉了揉头,做起在床上。点开了手机,微弱的灯光在乌黑的房间里亮起。...
    慕波雨松阅读 1,715评论 0 0

友情链接更多精彩内容