Dale Townsend
Dale Townsend

Reputation: 691

Semi-transparent overlay with tab bar

I am making an iOS game, and for my in-game pause menu would like an overlay window with 6 tabs at the bottom for the map, settings, etc. The whole pane will be slightly transparent and won't take up the whole screen.

What would be the best way to implement this? Would it be easiest to just create the six buttons and window programatically and add them to the view when the pause button is pressed? Or would it be possible to create a tab bar + window and adjust the alpha?

EDIT: I've added a custom view and buttons when the pause button is tapped:

UIImageView *backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Pause Layer_t" ofType:@"png"]]];
backgroundView.frame = CGRectMake(0, 0, 568, 320);
backgroundView.alpha = 0.8;
[self.view addSubview:backgroundView];

playButton = [UIButton buttonWithType:UIButtonTypeCustom];
[playButton addTarget:self
             action:@selector(backToGame)
   forControlEvents:UIControlEventTouchUpInside];
[playButton setImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Play Button_Menu" ofType:@"png"]] forState:UIControlStateNormal];
playButton.frame = CGRectMake(0, 266, 90, 53);
[self.view addSubview: playButton];

Upvotes: 1

Views: 399

Answers (1)

HalR
HalR

Reputation: 11083

The Tab Bar is not amenable to having 6 buttons on it. It will put the extra buttons beyond 4 into an "other" category.

You should just create your own view with your own buttons. You can "gamify" it better that way. Just make them custom buttons on a view and give them selector targets.

Upvotes: 2

Related Questions