KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have add a webview,a titleLabel and a coverflowView on a viewcontroller's view as its subviews, I want it to change size when the orientation change. I have change the webview's frame in this method: - (void)willRotateToInterfaceOrientation: (UIInterfaceOrientation)toInterfaceOrientation duration: (NSTimeInterval)duration its content did resize when rotate iPad from orientationLandscape to orientationPortrait or from orientationPortrait to orientationLandscape if I start the application with portrait orientation, but it is so strange that its content dosen't resize when I start the application with landscape orientation...But the NSLog shows the frame has changed. As to the titleLabel and the coverflowView, they resize correctly. I doubt if it is because of css?I have use css to control the content's style according to the height and width of webview.Does anyone could help me to find the reason? the code is below: - (void)willRotateToInterfaceOrientation: (UIInterfaceOrientation)toInterfaceOrientation duration: (NSTimeInterval)duration { double i = 0; NSInteger width=self.view.frame.size.width; NSInteger height=self.view.frame.size.height; NSLog(@"view :%@",[self.view description]); switch (toInterfaceOrientation){ case UIInterfaceOrientationPortrait: { NSLog(@"rotate to Portrait"); if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){ self.docView.frame=CGRectMake(0, 50, width+20, height-70); self.toolbar.frame=CGRectMake(0, 0,height , 50); for (UIView * view in [toolbar subviews]) { if ([view isKindOfClass:[UIButton class]] && view.tag==kBackButtonTag){ view.frame=CGRectMake(width-60, 6, 50, 36); }else if([view isKindOfClass:[UIButton class]] && view.tag==kReloadButtonTag){ view.frame=CGRectMake(width-160, 6, 80,36 ); } }
Tags (comma-separated)
Save Edits
Cancel