Contains only. About the code of the screen
#import "InspectionReportViewController.h"#defineScreen_width ([UIScreen mainscreen].bounds.size.width)#defineScreen_height ([UIScreen mainscreen].bounds.size.height)@interfaceInspectionreportviewcontroller () <UIWebViewDelegate>{UIWebView*WebView; UIButton*Back ;}@end@implementationInspectionreportviewcontroller-(BOOL) shouldautorotate{returnNO;}-(uiinterfaceorientationmask) supportedinterfaceorientations{//if the interface needs to support the screen switching returnUiinterfaceorientationmasklandscaperight |uiinterfaceorientationmaskportrait; //if the interface only supports horizontal screen//return uiinterfaceorientationmasklandscaperight;}-(void) Viewwillappear: (BOOL) animated{[Super viewwillappear:animated]; }-(void) Viewwilldisappear: (BOOL) animated{[Super viewwilldisappear:animated]; }- (void) viewdidload {[Super viewdidload]; //Do any additional setup after loading the view.[self creatui]; //Horizontal screen comrade Uiapplicationdidchangestatusbarframenotification uideviceorientationdidchangenotification[[Uidevice Currentdevice] begingeneratingdeviceorientationnotifications]; [[Nsnotificationcenter Defaultcenter] addobserver:self selector: @selector (deviceorientationdidchange) Name: UideviceorientationdidchangenotificationObject: nil];}-(void) creatui{Self.view.backgroundColor=[Uicolor Blackcolor]; WebView=[[UIWebView alloc] initWithFrame:self.view.bounds]; Webview.backgroundcolor=[Uicolor Blackcolor]; [WebView loadrequest:[nsurlrequest requestwithurl:[nsurl urlwithstring:[nsstring stringWithFormat:@"http://60.205.188.204:8087/webdcmviewer/dcmviewer.html?org_code=%@&check_id=%@", _org_code,_check_id]]]; Webview.scalespagetofit=YES; Webview.scrollView.scrollEnabled=NO; [Self.view Addsubview:webview]; back= [MyButton buttonwithtype:uibuttontypecustom frame:cgrectmake (Screenwidth-iphonewidth ( -), Screenheight-iphonehight ( -), Iphonewidth ( -), Iphonehight ( -)) Tag:1Image@"Ic_history_ct_return"andblock:^ (MyButton *button) {[Self.navigationcontroller popviewcontrolleranimated:yes]; }]; [Self.view Addsubview:back]; }//Horizontal Screen- (void) deviceorientationdidchange{NSLog (@"deviceorientationdidchange:%ld",(Long) [Uidevice currentdevice].orientation); if([uidevice Currentdevice].orientation = =uideviceorientationportrait) {[[UIApplication sharedapplication] setstatusbarorientation:uiinterfaceorientationportrait]; [UIView animatewithduration:0.1fanimations:^{self.view.transform= Cgaffinetransformmakerotation (0); Self.view.bounds= CGRectMake (0,0, Screen_width, screen_height); Webview.frame=Self.view.bounds; Back.frame= CGRectMake (Screen_width-iphonewidth ( the), Screen_height-iphonehight ( -), Iphonehight ( -), Iphonehight ( -)); }]; //Note: uideviceorientationlandscapeleft and Uiinterfaceorientationlandscaperight}Else if([uidevice Currentdevice].orientation = =uideviceorientationlandscapeleft) {[[UIApplication sharedapplication] setstatusbarorientation:uiinterfaceorientationlandscaperight]; [UIView animatewithduration:0.1fanimations:^{self.view.transform=cgaffinetransformmakerotation (m_pi_2); Self.view.bounds= CGRectMake (0,0, Screen_height, screen_width); Webview.frame=Self.view.bounds; Back.frame= CGRectMake (Screen_width-iphonewidth ( the), Screen_height-iphonehight ( -), Iphonehight ( -), Iphonehight ( -)); }]; }Else if([Uidevice currentdevice].orientation==uideviceorientationlandscaperight) {[[UIApplication sharedapplication] setstatusbarorientation:uiinterfaceorientationlandscapeleft]; [UIView animatewithduration:0.1fanimations:^{self.view.transform= Cgaffinetransformmakerotation (-m_pi_2); Self.view.bounds= CGRectMake (0,0, Screen_height, screen_width); Webview.frame=Self.view.bounds; Back.frame= CGRectMake (Screen_width-iphonewidth ( the), Screen_height-iphonehight ( -), Iphonehight ( -), Iphonehight ( -)); }]; }}/*#pragma mark-navigation//in a storyboard-based application, you'll often want to do a little preparation before n avigation-(void) Prepareforsegue: (Uistoryboardsegue *) Segue Sender: (ID) Sender {//Get the new view controller using [s] Egue Destinationviewcontroller]. Pass the selected object to the new view controller.}*/@end
IOS works by default only allows vertical screen, in a separate interface to convert vertically, screen rotation