IOS frame size with dimensions

I am using xCode 6 classes and sizes for my application.

I encounter a very strange problem that I do not understand.

I have a UIView, which restrictions are in the UIViewController, I set a width limit for Any x Any (150x150) size classe, and another widh limit for Regular x Regular (300x300).

When I register the size of my UIView when the application is running on the iPad, I run into a problem.

In fact, in "viewWillAppear", "viewWillLayoutSubviews" or "viewDidLayoutSubviews" I get a size of "150x150" instead of "300x300".

My magazines:

- (void) viewWillAppear:(BOOL)animated {
    NSLog(@"viewWillAppear Size %f - %f",         
    self.myView.frame.size.width, self.myView.frame.size.height);
}

- (void) viewDidAppear:(BOOL)animated {
    [super viewDidAppear:YES];
    NSLog(@"viewDidAppear Size %f - %f",     
   self.myView.frame.size.width, self.myView.frame.size.height);
  }

 - (void) viewWillLayoutSubviews {
     [super viewWillLayoutSubviews];
     NSLog(@"viewWillLayoutSubviews Size %f - %f",   
     self.myView.frame.size.width, self.myView.frame.size.height);
 }

 - (void) viewDidLayoutSubviews {
     [super viewDidLayoutSubviews];
     NSLog(@"viewDidLayoutSubviews Size %f - %f",     
     self.myView.frame.size.width, self.myView.frame.size.height);
 }

What I do not understand, the logs show:

2015-02-17 09:29:38.984 myApp[660:42565] viewDidLoad Size   
150.000000 - 150.000000

2015-02-17 09:29:38.985 myApp[660:42565] viewWillAppear Size    
150.000000 - 150.000000

2015-02-17 09:29:39.047 myApp[660:42565] viewWillLayoutSubviews 
Size 150.000000 - 150.000000

2015-02-17 09:29:39.058 myApp[660:42565] viewDidLayoutSubviews 
Size 150.000000 - 150.000000

2015-02-17 09:29:39.063 myApp[660:42565] viewWillLayoutSubviews  
Size 230.000000 - 230.000000

2015-02-17 09:29:39.063 myApp[660:42565] viewDidLayoutSubviews 
Size 230.000000 - 230.000000

2015-02-17 09:29:39.586 myApp[660:42565] viewDidAppear Size 
230.000000 - 230.000000

2015-02-17 09:29:39.591 myApp[660:42565] viewWillLayoutSubviews 
Size 230.000000 - 230.000000

2015-02-17 09:29:39.593 myApp[660:42565] viewDidLayoutSubviews  
Size 230.000000 - 230.000000

So what is going on? Why is the first time I get the class size Any x Any size? And why are these methods called many times?

, viewDidAppear, , . ( - , ...)

+4
2

" ( : D):

viewDidLoad :

if(UIDEVICE == IPAD) {
    [self.view layoutIfNeeded];
}

, , , .....: (

+1

UIView - (void) viewWillAppear:(BOOL)animated .

    - (void) viewWillAppear:(BOOL)animated {

        [self.view layoutIfNeeded];
        [self.myView layoutIfNeeded];

        NSLog(@"viewWillAppear Size %f - %f",         
        self.myView.frame.size.width, self.myView.frame.size.height);
    }
0

All Articles