查项目有需求 让系统弹出页面也不能旋转
实现思路
利用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