LE SANG
LE SANG

Reputation: 11005

How to auto resize view in Lua used Corona SDK?

I create new Tabbar based project in Corona. Then I change file build.settings to support landscape orientation

orientation = {
    default = "portrait",
    supported = { "portrait","landscapeLeft","landscapeRight" }
}, 

The problem is that the view don't resize when rotate to landscape.

enter image description here

How to enable autoresize in Lua using Corona SDK?

Thanks!

Upvotes: 2

Views: 834

Answers (2)

Julian
Julian

Reputation: 9140

The selected answer is not entirely correct. You should be listening to event.resize and not event.orientation.

From the orientation docs:

However, for apps with multiple supported orientations, the orientation event should not be used to re-layout the UI — instead, the resize event should be used.

Upvotes: 1

efdee
efdee

Reputation: 2271

I don't think Corona SDK gives you autoresize out of the box. I think you are supposed to listen for the 'orientation' event on the Runtime object to be notified when the device is rotated, then reposition your controls accordingly.

See the Events and Listeners section of the Corona SDK documentation (search for 'orientation' on that page).

Upvotes: 1

Related Questions