Reputation: 1491
I am trying to group related buttons together so that I can show/hide/move them all as one. I have determined that using a UIView would probably be the best bet however, when I try this the the sub view doesn't show up. I'm wondering what I may be doing wrong.
UIView *playerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, view.frame.size.width, 50)];
[playerView setBackgroundColor:[UIColor colorRed]];
[view addSubview:playerView];
Am I doing something obviously wrong?
Upvotes: 1
Views: 150
Reputation: 8237
Just tried it. It works for me, but you need to fix one small thing:
colorRed -> redColor;
[playerView setBackgroundColor:[UIColor redColor]];
Upvotes: 1
Reputation: 12106
The only thing I can see in your code that might cause this is if the view.frame.size.width is 0. Is "view" itself visible?
Upvotes: 1
Reputation: 25930
Are you sure that view.frame.size.width is > 0 at that time? Where does that code get executed?
Try using a number for the width instead of view.frame.size.width and see if you get different results.
Upvotes: 1