iphone - UIView not resizing in code or interface builder -
i creating simple uiview , adding main view - changing frame no matter try doesn't resize view - lumps huge view down onto superview. changing view size in interface builder has no effect either:
- (void)mapview:(mkmapview *)mapview annotationview:(mkannotationview *)view calloutaccessorycontroltapped:(uicontrol *)control { hotelinformationviewcontroller *vc = [[hotelinformationviewcontroller alloc]initwithnibname:@"hotelinformationviewcontroller" bundle:nil control:control]; [self.view addsubview:vc.view]; } - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil control:(uicontrol *)control { if ((self = [super initwithnibname:nibnameornil bundle:nibbundleornil])) { self.view.bounds = cgrectmake(control.frame.origin.x, control.frame.origin.y, 286, 286); //this size want view 286, 286 } return self; }
you should calling self.view.frame = cgrectmake(...)
. frame
property represents position , size of view within superview, , thing change move or resize view.
(the bounds
attribute internal boundaries of view's coordinate system frames of view's subviews exist within, , it's if ever necessary explicitly set it)
Comments
Post a Comment