//
// 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 强制横屏的更多相关文章

  1. iOS强制横屏

    由于项目需求,需要整个项目页面都是竖屏,唯独一个折线图页面强制性横屏显示. 网上逛了许多帖子,也看了好多大神的提供的方法,都没能够实现本屌丝想要的效果.没办法自己研究自己搞,借鉴各路大神的思路,最后费 ...

  2. iOS强制横屏或强制竖屏

    原文链接 https://www.jianshu.com/p/d6cb54d2eaa1 亲测第二种我这边是阔以滴 第一种解决方案(不推荐,直接跳过看第二种解决方案): //强制转屏 - (void)i ...

  3. iOS 9 强制横屏

    首先在plist 文件中 Supported interface orientations 选项 只留下一个 portrait 屏幕强制横屏 使用以下代码 self.navigationControl ...

  4. iOS设置某个界面强制横屏,进入就横屏

    最近有一个项目,例如:A界面跳转到B界面,A界面是竖屏的,B界面进入就要横屏. 花了半天的时间在网上搜索解决方案,有些论坛的大牛也就贴两行代码,具体实现也没有,对我们这种菜鸟造成一万点真实伤害.为了避 ...

  5. iOS不勾选设置,实现某个界面强制横屏

    1.在不勾选横屏的前提下,实现某一个界面横屏显示,比如播放视频.图表显示等. 2.只能Present跳转,Push会无效. 3.实现代码 在需要横屏的VC里,添加如下代码 #pragma mark 强 ...

  6. ios开发之 -- 强制横屏

    在写项目的时候,会遇到很多稀奇古怪的需求,我就碰到一个写一个网站,需要强制横屏,然后不需要上架,网上看了很多大神的需求,基本都能实现,但是不太好用, 自己参考搞了一个,代码如下: AppDelegat ...

  7. 【转】从viewController讲到强制横屏,附IOS5强制横屏的有效办法

    文字罗嗦,篇幅较长,只需营养可直接看红字部分. 一个viewController的初始化大概涉及到如下几个方法的调用: initWithNibName:bundle: viewDidLoad view ...

  8. Android开发中如何强制横屏和强制竖屏设置

    Android开发中如何强制横屏和强制竖屏设置 强制横屏设置: 按照下面代码示例修改Activity的onResume方法 @Override protected void onResume() { ...

  9. 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. 2.1 linux中uboot移植

    -- --------------------------------------------------------------------------------------- (一)友善之臂介绍 ...

  2. WINCE6.0远程桌面显示修改

    备注:用RDP表示远程桌面 WINCE6.0自带的远程桌面在我们显示屏分辨率为240*320上有一部分内容无法显示出来,所以就需要调整界面让这些内容可见. 1.      PB6.0不支持对远程桌面资 ...

  3. 【HDOJ】1914 The Stable Marriage Problem

    稳定婚姻问题,Gale-Shapley算法可解. /* 1914 */ #include <iostream> #include <sstream> #include < ...

  4. asp mvc 路由

    public override void RegisterArea(AreaRegistrationContext context) { context.MapRoute( "Workflo ...

  5. 使用委托的BeginInvoke方法来完成复杂任务的操作

    现在假设我有这样一个窗体(包含一个进度条和一个按钮与两个文本框),在第一个文本框中输入一个数字进行阶乘运算,在此过程中进度条与运算进度保持一致,同时可以在第二个文本框中进行其它工作(比如输入).对付这 ...

  6. Spring入门之HelloSpring

    Spring描述: -轻量级:Spring是非侵入式的-基于Spring开发的应用中的对象可以不依赖于Spring的API -依赖注入(DI---dependency injection,IOC) - ...

  7. chmod命令

    chmod命令用于改变linux系统文件或目录的访问权限.用它控制文件或目录的访问权限.该命令有两种用法.一种是包含字母和操作符表达式的文字设定法:另一种是包含数字的数字设定法. Linux系统中的每 ...

  8. PLSQL Develop 配置

    plsq 连接oracle数据库的配置步骤: 1.下载oracle客户端: 下载地址:http://www.oracle.com/technetwork/topics/winx64soft-08954 ...

  9. SimpleHttpServer的学习之UML

    如何分析一个稍微大点的源码呢? 静态分析 除了看代码,就是 uml图,UML虽然在书本类与类之间的关系很复杂,可能要一本书,但是最核心的其实很简单: (1)继承 extends (2)实现接口 imp ...

  10. GC roots 总结

      previous      content      next   GC roots The so-called GC (Garbage Collector) roots are objects ...