UIView layer problems
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];
what about this:
aView.clipsToBounds = YES;
use this thing to manage views.
[self.view bringsubviewtofront:uiview]; and also use the [self.view bringsubviewtoback:uiview];
精彩评论