2D Toolkit Forum

2D Toolkit => Support => Topic started by: kujo on December 06, 2013, 10:41:31 am

Title: Full width sprite scaling for mobile
Post by: kujo on December 06, 2013, 10:41:31 am
Hi guys,

Working on some UI, and the design I have has a navigation bar (like iPhone) across the top of the screen. This works fine on iPhone, but when this goes onto iPad, the sprite doesn't fit on screen (its too short), and the buttons I put on there don't move. I have a 2D Toolkit camera in the scene, and I'm using an Upper Anchor to position the navbar at the top. I have a game object with a UILayout component on it and then the sprite itself. The anchors of UILayout are set to fill.

Whats the best way to handle this? its ok if the navigation bar sprite is stretched, but not the buttons.

Thanks.
Title: Re: Full width sprite scaling for mobile
Post by: unikronsoftware on December 07, 2013, 03:22:24 pm
If you have a UILayout on there, you can resize to fill the screen quite easily. Check UI Demo 2, keep clicking the button, it cycles between a few different sizes, one of them is fullscreen. The code is pretty simple in there.