views:

52

answers:

2

Hey there,

I'm creating an app that has a tabbar at the bottom and no status or navigation bar at the top. I want to create a teaser view at the top that is 320x50. It will appear on top the main view for some of the tabs. Similar to the way an ad might appear over a view. Sometimes the teaser view will be hidden. When a user clicks a button in the teaser, I want it to expand down taking over the view including the tabbar.

Are there any samples out there or suggestions?

best, Howie

A: 

Well, unless I missed something this doesn't look too complicated to me.

You should simply create a class for this "teaser view" which inherits from UIViewController, using a nib if needed. Create the callback methods for the teaser buttons, expanding the teaser's size (by changing view.frame), or removing it from it's superview if needed.

Then when you want to display a teaser, instantiate one, fill its data and simply add its view to your current view's subviews.

TL;DR : I think the teaser view should be a UIViewController whose view is added to your tab's subviews.

Jukurrpa
thanks, i've got that part going. It's the second view, the one that takes up the entire screen after interacting with the teaser. For some reason the buttons on that view can't be interacted with. I've tried sending view to the back and bringing others to the front. nothing seems to work.
Ward
Which way do you create and add the second view? Edit your first post with the code if needed.
Jukurrpa
A: 

I figured it out. Probably had something to do with instantiating the view that takes over the entire screen (I called it Main) within the init method instead of the load view method. Also, instead of using separate teaser and main view controllers, I created one view controller and use uiviews to hold the teaser area and the main area. That way I can hide and reveal the teaser which is 50 pixels high and separately hide and reveal the main area that has a y of 50 and a height of 381 (480 - tab bar height of 49 - teaser height of 50).

Now I can click a button in the teaser, the main area will expand down taking up the entire screen (except for the tabbar). When I click close, the main area will contract up behind the teaser view off the top of the screen.

Ward