It's important to optimize your image file size as much as you can. Using full-screen images can impact the performance of your application. They require more time to load on a device and consume a lot of texture memory. When a lot of memory is consumed in an application, in most cases it'll be forced to quit.
The iOS devices vary in the size of their available memory, depending on which one you have out of the following:
For example, texture memory on the iPhone 3GS should be kept under 25 MB before performance issues start occurring by slowing down your app or even forcing it to quit. An iPad 2 would have no problem going farther down that boundary since it has more memory available.
Refer to http://docs.coronalabs.com/api/event/memoryWarning/index.html to apply memory warnings for iOS devices.
For Android devices, there is around a 24 MB memory limit. So, it's important to be aware of how many display objects you have in your scene and how to manage them when they are not needed in your app any more.
In cases when you no longer need an image to be displayed on screen, use the following code:
image.parent:remove( image ) -- remove image from hierarchy
Alternatively, you can also use this line of code:
image:removeSelf( ) -- same as above
If you want to remove an image from the scene completely throughout the lifetime of your app, include the following line after your image.parent:remove( image )
or image:removeSelf()
code:
image = nil
Keeping memory usage low within your application will prevent crashes and improve performance. For more information on optimization, go to http://developer.coronalabs.com/content/performance-and-optimization.
Q1. Which of the following are values?
Q2. Which relational operator is false?
print(0 == 0)
print(3 >= 2)
print(2 ~= 2)
print(0 ~= 2)
Q3. What is the correct way to scale an object in the x direction?
object.scaleX
object.xscale
object.Xscale
object.xScale