Passing dynamic scaling to coronaController/coronaView

Will it be possible to dynamically pass the width/height used for the dynamic scaling to the coronaView?

The idea is to use native methods to get proper width/height for different devices, this will help a lot for non games apps that use widgets, for example I want the TableView row height to always be 0.4 Inch no matter of the device resolution and size used.

 

Not yet. I’ll log this as a feature request. 

For IOS it should be something like a initWithConfiguration method for controller and pass a NSDictionary to Corona and be able to access that NSDictionary as a Lua table.

Not yet. I’ll log this as a feature request. 

For IOS it should be something like a initWithConfiguration method for controller and pass a NSDictionary to Corona and be able to access that NSDictionary as a Lua table.

+1

In the current version (or anything above 2207) you should be able to do this by creating an instance of NSDictionary passing in the contentWidth/Height. You probably want to remove the width/height settings in your config.lua:

NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:

  [NSNumber numberWithInt:640], @“contentWidth”,

  [NSNumber numberWithInt:480], @“contentHeight”,

  nil];

 

// Passing nil to run main.lua in root of the .app bundle

[coronaView runWithPath:nil parameters:params];

I am currently using Corona Cards, 2014.2238.

Can you give a better example of how this is supposed to work?

I am calling the method provided using the described method of doing so, and then check to the information on the LUA side. 

The size does not change, and I would like to verify that I am using the method in the intended way.

Here is the obj-c code I am using to accomplish this.

[coronaView runWithPath:nil parameters:@{ @"contentWidth": @([[self view] frame].size.height), @"contentHeight": @([[self view] frame].size.width) }];

On the LUA, do I need to attach a listener to the Runtime to see the size change, or does it handle the size change automatically?

Thanks :slight_smile:

+1

In the current version (or anything above 2207) you should be able to do this by creating an instance of NSDictionary passing in the contentWidth/Height. You probably want to remove the width/height settings in your config.lua:

NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:

  [NSNumber numberWithInt:640], @“contentWidth”,

  [NSNumber numberWithInt:480], @“contentHeight”,

  nil];

 

// Passing nil to run main.lua in root of the .app bundle

[coronaView runWithPath:nil parameters:params];

I am currently using Corona Cards, 2014.2238.

Can you give a better example of how this is supposed to work?

I am calling the method provided using the described method of doing so, and then check to the information on the LUA side. 

The size does not change, and I would like to verify that I am using the method in the intended way.

Here is the obj-c code I am using to accomplish this.

[coronaView runWithPath:nil parameters:@{ @"contentWidth": @([[self view] frame].size.height), @"contentHeight": @([[self view] frame].size.width) }];

On the LUA, do I need to attach a listener to the Runtime to see the size change, or does it handle the size change automatically?

Thanks :slight_smile: