some_id
some_id

Reputation: 29906

Adding and switching between subviews

I have a View which I want to have a label and 2 buttons on the top in a panel. This area wouldnt change.

Instead of new view and Xib files and setting their position to below the main view, I would like to know how one can add a subview to the main view so that the subview can change and be modified.

Or is it better to go with separate views?

Upvotes: 0

Views: 205

Answers (1)

Henrik P. Hessel
Henrik P. Hessel

Reputation: 36647

Did you try the standard way?

CGRect myFrame = CGRectMake(0, 0, 320, 30);
UIView *myView = [[UIView alloc] initWithFrame:myFrame];
myView.backgroundColor = [UIColor blackColor];
[self.view addSubview:myView];
[myView release];

Your new View will overlap your current view.

Upvotes: 2

Related Questions