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
Post a Comment