iOS 强制横屏
//
// AAAAViewController.m
// hengp
//
// Created by 朱信磊 on 15/2/13.
// Copyright (c) 2015年 niit. All rights reserved.
// #import "AAAAViewController.h"
#import "AppDelegate.h"
@interface AAAAViewController () @end @implementation AAAAViewController - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
[self initView];
}
return self;
}
-(void)initView{
UIButton *bt=[[UIButton alloc]initWithFrame:CGRectMake(, , , )];
[bt setTitle:@"返回" forState:UIControlStateNormal];
[bt setBackgroundColor:[UIColor blueColor]];
[bt addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:bt]; AppDelegate *appdelegate=[[UIApplication sharedApplication] delegate];
[[UIApplication sharedApplication] setStatusBarOrientation:UIDeviceOrientationLandscapeRight animated:YES];
CGFloat duration = [UIApplication sharedApplication].statusBarOrientationAnimationDuration;
//设置旋转动画
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:duration];
//设置导航栏旋转
appdelegate.nav.navigationBar.frame = CGRectMake(-, , , );
appdelegate.nav.navigationBar.transform = CGAffineTransformMakeRotation(M_PI*1.5);
//设置视图旋转
self.view.bounds = CGRectMake(, -, self.view.frame.size.width, self.view.frame.size.height);
self.view.transform = CGAffineTransformMakeRotation(M_PI*1.5);
[self setNeedsStatusBarAppearanceUpdate];
[UIView commitAnimations]; }
- (UIStatusBarStyle)preferredStatusBarStyle
{
return UIStatusBarStyleLightContent;
}
//
- (BOOL)prefersStatusBarHidden//for iOS7.0
{
return YES;
} - (void)viewDidLoad {
[super viewDidLoad];
[self.view setBackgroundColor:[UIColor whiteColor]]; } - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
} -(void)back{
AppDelegate *appdelegate=[[UIApplication sharedApplication] delegate];
[appdelegate.nav popViewControllerAnimated:YES];
} /*
#pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/ @end
iOS 强制横屏的更多相关文章
- iOS强制横屏
由于项目需求,需要整个项目页面都是竖屏,唯独一个折线图页面强制性横屏显示. 网上逛了许多帖子,也看了好多大神的提供的方法,都没能够实现本屌丝想要的效果.没办法自己研究自己搞,借鉴各路大神的思路,最后费 ...
- iOS强制横屏或强制竖屏
原文链接 https://www.jianshu.com/p/d6cb54d2eaa1 亲测第二种我这边是阔以滴 第一种解决方案(不推荐,直接跳过看第二种解决方案): //强制转屏 - (void)i ...
- iOS 9 强制横屏
首先在plist 文件中 Supported interface orientations 选项 只留下一个 portrait 屏幕强制横屏 使用以下代码 self.navigationControl ...
- iOS设置某个界面强制横屏,进入就横屏
最近有一个项目,例如:A界面跳转到B界面,A界面是竖屏的,B界面进入就要横屏. 花了半天的时间在网上搜索解决方案,有些论坛的大牛也就贴两行代码,具体实现也没有,对我们这种菜鸟造成一万点真实伤害.为了避 ...
- iOS不勾选设置,实现某个界面强制横屏
1.在不勾选横屏的前提下,实现某一个界面横屏显示,比如播放视频.图表显示等. 2.只能Present跳转,Push会无效. 3.实现代码 在需要横屏的VC里,添加如下代码 #pragma mark 强 ...
- ios开发之 -- 强制横屏
在写项目的时候,会遇到很多稀奇古怪的需求,我就碰到一个写一个网站,需要强制横屏,然后不需要上架,网上看了很多大神的需求,基本都能实现,但是不太好用, 自己参考搞了一个,代码如下: AppDelegat ...
- 【转】从viewController讲到强制横屏,附IOS5强制横屏的有效办法
文字罗嗦,篇幅较长,只需营养可直接看红字部分. 一个viewController的初始化大概涉及到如下几个方法的调用: initWithNibName:bundle: viewDidLoad view ...
- Android开发中如何强制横屏和强制竖屏设置
Android开发中如何强制横屏和强制竖屏设置 强制横屏设置: 按照下面代码示例修改Activity的onResume方法 @Override protected void onResume() { ...
- Css实现手机端页面强制横屏的方法示例
样式 ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 @media screen ...
随机推荐
- 微信支付开发1 微信支付URL配置
本文介绍微信支付申请时如何设置授权目录及URL. 一.选择支付类型 目前有两种支付类型 JS API网页支付 Native原生支付 如果没有特殊要求,两种都勾选. 二.支付授权目录 目前可以选择htt ...
- Android开发之少去踩坑,多走捷径【转】
作者:gzjay,腾讯MIG无线产品部 高级工程师 最近一朋友提了几个Android问题让我帮忙写个小分享,我觉得对新人还是挺有帮助的,所以有了这个小分享. 1.目前, Android APP开发完成 ...
- IE中Ajax数据缓存的问题
在IE中,Ajax回来的数据会有缓存的现象发生,解决方式: 1,改变URL,每次请求加一个随机数参数Math.random()或者new Date().getTime(),这样IE会认为URL不一样, ...
- oracle 字段上下两条记录的相减
SELECT T.ID ,BALANCE,nvl(lag (BALANCE,1) over (order by T.ID ) ,0) FROM AN T ORDER BY T.ID [转]orac ...
- CI的知识点
1. 超级对象中$this->uri 获取pathinfo中的值,$this->uri->segment(n)中的n表示第几个参数 如:/welcome/index/1 使用$th ...
- c语言编译预处理和条件编译执行过程的理解
在C语言的程序中可包括各种以符号#开头的编译指令,这些指令称为预处理命令.预处理命令属于C语言编译器,而不是C语言的组成部分.通过预处理命令可扩展C语言程序设计的环境. 一.预处理的工作方式 1.1. ...
- Android 自动换行流式布局的RadioGroup
效果图 用法 使用FlowRadioGroup代替RadioGroup 代码 import android.content.Context; import android.util.Attribute ...
- 【转】Angular运行原理揭秘 Part 1
当你用AngularJS写的应用越多, 你会越发的觉得它相当神奇. 之前我用AngularJS实现了相当多酷炫的效果, 所以我决定去看看它的源码, 我想这样也许我能知道它的原理. 下面是我从源码中找到 ...
- POJ 3126 Prime Path BFS搜索
题意:就是找最短的四位数素数路径 分析:然后BFS随便搜一下,复杂度最多是所有的四位素数的个数 #include<cstdio> #include<algorithm> #in ...
- 恒天云技术分享系列2 - vlan管理GUI开发
恒天云:http://www.hengtianyun.com/download-show-id-10.html 在OpenStack G版本中quantum网络模式下,horizon提供了基于quan ...