Reputation: 496
I have a problem with UIViews, I have a white UIView with the frame 240*320, and a black UIView with the frame 480*20 and I add the white view to my landscape mainView which is 480*320 and then I add the black view to the white view, and the black view is not only above the white view but also above the mainView, and I don't want to be above the mainView, does anybody know a solution?, this is the code:
UIView *aView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 240, 320)];
UIView *otherView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 480, 20)];
[aView setBackgroundColor:[UIColor whiteColor]];
[otherView setBackgroundColor:[UIColor blackColor]];
[aView addSubview:otherView];
[[self view] addSubview:aView];
Upvotes: 0
Views: 965
Reputation: 5540
use this thing to manage views.
[self.view bringsubviewtofront:uiview]; and also use the [self.view bringsubviewtoback:uiview];
Upvotes: 1