I have a UIView and UIButton (declared in viewDidLoad: method of RootViewcontroller. ).
UIView *geopointView = [[UIView alloc] initWithFrame:CGRectMake(0, 320, 120, 100)] ;
UIButton *mybutton = [[UIButton alloc] initWithFrame:CGRectMake(0, 330, 120, 30)] ;
mybutton is added to geopointView.
[geopointView addsubView:mybutton];
Finally UIView is added to RootViewController in method showTheView (defined in rootViewController)
-(void) showTheView{
[self.view addsubView:geopointView];
}
but when this method is called,I find that both mybutton and geopointView are visible but mybutton is not placed inside of geopointView. mybutton’s bounds now appear as CGRectmake(10, 250, 120, 30);
Can anyone please tell what I am missing here. Thanks for any help in advance.
try this