# Content Scaling

**URL:** <https://forums.solar2d.com/t/content-scaling/343195>\
**Category:** CoronaCards for iOS / Android\
**Created:** [February 17, 2017, 4:38am UTC](https://forums.solar2d.com/t/content-scaling/343195 "2017-02-17T04:38:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![abhilash4](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/a/d26b3c/32.png) [@abhilash4](https://forums.solar2d.com/u/abhilash4)\
**Post date:** [February 17, 2017, 4:38am UTC](https://forums.solar2d.com/t/content-scaling/343195/1 "2017-02-17T04:38:27Z")

</div>

I have integrated Corona SDK project into existing xcode project using corona cards.&nbsp;

**On Corona SDK/Corona Simulator:**

- I am loading an image on the view port and it display as intended. Here’s the screenshot: [link](http://imgur.com/a/ofLkp)
- Below is the configuration details:

**config.lua**

```
application = { content = { width = 720, height = 1280, scale = "letterbox", fps = 60, xAlign = "center", yAlign = "center" }, }

```

**main.lua**

```
local intro = display.newImageRect(params.base\_path .. "title.png", 1280, 720) intro.x = 640 intro.y = 360

```

The above works fine and the image fits correctly and maintains aspect ratio.

I have moved the code into “Corona” folder in the xcode project. When I run it in the iphone 7 simulator the image loads but does not load it correctly from position or scaling perspective. Here’s the screen shot: [link](http://imgur.com/a/TZxKe)

Here’s the Corona **View Controller** in xcode:

```
// Load corona view - (void)viewDidAppear:(BOOL)animated { \_coronaController = [[CoronaViewController alloc] init]; [self addChildViewController:\_coronaController]; CoronaView \*coronaView = (CoronaView \*)\_coronaController.view; coronaView.frame = self.view.frame; [self.view addSubview:coronaView]; // Transparent background coronaView.backgroundColor = [UIColor clearColor]; coronaView.opaque = NO; // Prepare params NSDictionary \*event = [NSDictionary dictionaryWithObjectsAndKeys: @"playEvent", @"name", @"playGame", @"phase", \_Name, @"gName", nil]; [coronaView run]; //Send event [coronaView sendEvent:event]; }

```

Any thoughts?

---

<div class="post-metadata">

**Author:** ![abhilash4](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/a/d26b3c/32.png) [@abhilash4](https://forums.solar2d.com/u/abhilash4)\
**Post date:** [February 27, 2017, 10:34pm UTC](https://forums.solar2d.com/t/content-scaling/343195/2 "2017-02-27T22:34:42Z")

</div>

Resolved this issue by updating the following:  
&nbsp;

```
CGRect appFrame = [UIScreen mainScreen].bounds; \_coronaView.frame = CGRectMake(0, 0, appFrame.size.height, appFrame.size.width); [self.view addSubview:\_coronaView]; [\_coronaView setNeedsLayout];

```

Hope this helps others

---

<div class="post-metadata">

**Author:** ![abhilash4](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/a/d26b3c/32.png) [@abhilash4](https://forums.solar2d.com/u/abhilash4)\
**Post date:** [February 27, 2017, 10:34pm UTC](https://forums.solar2d.com/t/content-scaling/343195/3 "2017-02-27T22:34:42Z")

</div>

Resolved this issue by updating the following:  
&nbsp;

```
CGRect appFrame = [UIScreen mainScreen].bounds; \_coronaView.frame = CGRectMake(0, 0, appFrame.size.height, appFrame.size.width); [self.view addSubview:\_coronaView]; [\_coronaView setNeedsLayout];

```

Hope this helps others
