-1

I am launching my app (iPhone and iPand) in landscape mode.

I found that frame for iPad frame changes in viewDidAppear , than the one in viewWillAppear.


IOS IPAD 5.1 simulator

In viewWillAppear it is 0.000000 20.000000 768.000000 1004.000000.

while ,In viewDidAppear it is 0.000000 0.000000 748.000000 1024.000000


IOS IPAD 6.0 simulator [but quite supprised with ios 6 ipad simulator]

In viewWillAppear it is 0.000000 0.000000 748.000000 1024.000000

while ,In viewDidAppear it is same as viewWillAppear.


So, can I set frame for my subViews in viewDidAppear? as here is get the perfect frame.

For iphone the results are same in both the methods 20.000000 0.000000 300.000000 480.000000.

Why am I getting different behaviour in iPad and iPhone?

Info.plist has "Supported interface orientations" for Landscape left and Right and "Initial interface orientation" is set to landscapeLeft.

AppLaunch method is as follows:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

         self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];

         self.viewController=[[ViewController alloc] init];

         self.window.rootViewController = self.viewController;
}

ViewController.m has the following methods

 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
     if(UIInterfaceOrientationIsLandscape(interfaceOrientation)){
         return YES;
     }
     return NO;
}

Please Find the project at this link

NNikN
  • 3,720
  • 6
  • 44
  • 86
  • 1
    Seems like a valid question to me. It would be nice if people down voting gave a bit of reasoning. You have a defined question, but there is almost nothing of your code, so we have no idea if the code you gave us is for iPad, iPhone or both or where the problem would in either your code or your IB files. Are you setting frames manually anywhere or is layout all handled in XIBs/storyboards? – DBD Sep 26 '12 at 19:39
  • @DBD good know from you regarding the question. I have uploaded the project, please find the link in the question. – NNikN Sep 27 '12 at 15:12

1 Answers1

0

can I set frame for my subViews in viewDidAppear?

You can set the frame wherever you want. Why couldn't you?

  • Also check for different behaviour of frame in iPhone and iPad mentioned in the question, where I have mentioned frame co-ordinates – NNikN Sep 09 '12 at 10:42
  • @andyPaul ah yes! OK so I suppose that has something to do with OS (more precisely UIKit) differences. –  Sep 09 '12 at 11:14
  • I am trying hard to solve the issues of frame in landscape mode. I referred to Apple Doc which says you can you transformation, but even that did not work. Then I found this solution of which I was not clear and you voted down. Please explain it in detail as to when to set frames in viewWillAppear and when in viewDidAppear. – NNikN Sep 09 '12 at 11:19
  • @andyPaul I didn't vote down. I don't know why this question received 2 downvotes, it's not that bad, though I didn't upvote it either. –  Sep 09 '12 at 12:43
  • Thanks for making it clear,I understand. If people votes down for a question they must provide a reason to it [i.e at least justify the down vote]. I know some genius might be thinking he has done a great job of voting down the question. – NNikN Sep 09 '12 at 13:04