标签:
最近用到视频播放功能:(Vitamio, 注:在Build Setting 里面的 Other Link Flag 添加-all_load)
iOS 8的屏幕旋转比较坑, 使用以下代码可以强制旋转
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{ return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight ); } - (BOOL)shouldAutorotate{ return YES; } - (NSUInteger)supportedInterfaceOrientations{ return UIInterfaceOrientationMaskAll; }
//强制切换 - (void)switchToLandspance{ [[UIDevice currentDevice] setValue:[NSNumber numberWithInteger:UIDeviceOrientationPortrait] forKey:@"orientation"];//这句话是防止手动先把设备置为横屏,导致下面的语句失效. [[UIDevice currentDevice] setValue:[NSNumber numberWithInteger:UIDeviceOrientationLandscapeLeft] forKey:@"orientation"]; }
注意: 需要项目支持横屏旋转(Project Setting 里的 Device Orientation)
标签:
原文地址:http://www.cnblogs.com/duwei/p/4581901.html