objective c - Resize on rotation -


i trying put uiscroll view on page fills page minus 10px margin around edge. have done. however, want uiscrollview resize device rotated, keeping 10px margin. code far is:

// screen dimensions, considering status bar scrollwidth = self.getscreensize.width   // evaluates 1004 in landscape & 748 in portrait scrollheight = self.getscreensize.height // evaluates 728 in landscape & 984 in portrait  scrollview = [[uiscrollview alloc] initwithframe:cgrectmake(10,10,scrollwidth,scrollheight)]; [scrollview setautoresizingmask:uiviewautoresizingflexiblewidth | uiviewautoresizingflexibleheight];  ... other stuff load scrollview content ...  [self.view addsubview:scrollview]; 

when launch app, scrollview wider page, irrespective of orientation launch in. removing [scrollview setautoresizingmask..... line makes scrollview fit perfectly, doesn't react device rotation.

what doing wrong?

use shouldautorotatetointerfaceorientation detect when screen going rotate, , change frame of scroll view:

cgrect frame = scrollview.frame //change frame scrollview.frame = frame; 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -