ios - iPad landscape showing portrait frame and bounds -
i developing ipad landscape app using storyboard. have done below steps same. app screen opening in landscape on simulator.. getting wrong frame.
- sample app template xcode storyboard.
- allow landscape orientation info-plist file
- storyboard -> uiviewcontroller -> simulated matrices -> changed orientation landscape
implemented below method in view controller.m
- (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation { // return yes supported orientations return ((interfaceorientation == uiinterfaceorientationlandscapeleft) || (interfaceorientation == uiinterfaceorientationlandscaperight)); }
now when take nslog of frame , bounds show me portrait frame.
- (void)viewdidload { [super viewdidload]; // additional setup after loading view, typically nib. nslog(@"bounds ::%@",nsstringfromcgrect(self.view.bounds)); nslog(@"frame ::%@",nsstringfromcgrect(self.view.frame)); }
result log :
bounds ::{{0, 0}, {748, 1024}} frame ::{{20, 0}, {748, 1024}}
am missing ?
in viewdidload method dont correct bounds. in viewdidappear method. viewdidappear method called when view loaded , has correct bounds.
Comments
Post a Comment