---
title: "[ios]MFMessageComposeViewController 等<MessageUI/MessageUI.h> 系统页面 禁旋转"
author: "119568242"
date: "2013-07-30T10:38:07Z"
tags: []
categories: ["移动开发"]
slug: "ios-mfmessagecomposeviewcontroller-messageui-messageui-h"
draft: false
lastmod: "2013-07-30T10:38:07Z"
id: 1915402
url: "https://poolo.iteye.com/blog/1915402"
---

查项目有需求 让系统弹出页面也不能旋转

实现思路

利用category覆写MFMessageComposeViewController 的

 

\- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation;)

(方法,ios 6则是另外2个方法)

 

代码

.h

@interface MFMessageComposeViewController(Portrait)

\- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation;

 

@end

 

.m

@implementation MFMessageComposeViewController(Portrait)

\- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{

    return (interfaceOrientation == UIInterfaceOrientationPortrait);

}

 

@end