Get UIView size in init method -


when call self.frame.size.height in init method of uiview 0 result.

uiview:

- (id)initwithframe:(cgrect)frame {     self = [super initwithframe:frame];     if (self) {         nslog(@"content,init: %f",self.frame.size.height); ... 

uiview creation:

m_content = [[content alloc] init]; m_content.frame=self.frame; 

the reason because frame (and size) gets set after init routine.

use

m_content = [[content alloc] initwithframe:self.frame]; 

instead of

m_content = [[content alloc] init]; m_content.frame=self.frame; 

Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -