查项目有需求 让系统弹出页面也不能旋转
实现思路
利用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
本文介绍了一种方法,通过覆写MFMessageComposeViewController的方法来阻止其界面在iOS设备上旋转,确保消息撰写界面始终保持在竖屏状态。

被折叠的 条评论
为什么被折叠?



