How to reduce app size using app thinning and explain different ways to reduce app size

159 Views Asked by At

I have .png images having 1.6 mb. I used few classes having 17 mb memory size but my project size 40 mb approximately. Can any one suggest best solution for reducing app size for uploading into app store.suggest me how to find largest file in my target file.(i used image assets, i don't have unused code).

2

There are 2 best solutions below

0
On

List of techniques that help you:

Remove Unused code

Generally third party libraries have lots of unused code. Include the code only related to features using in that app. If you find any images, music, extra content that is not using in app should be removed from the project. Load Resources on Demand

If your project includes resources like tutorial videos or graphics that are expected to be rarely needed, consider moving these onto a web-server somewhere and have your application load them on-demand. Amazon’s S3 service or a small VPS on Linode will typically do the trick quite well. Discretion is needed with this technique since you want to avoid frustrating the user with a massive download after installation.

Use patterned images

UIColor includes a fantastic feature for reducing the need to include large textured images within your project. An example of this is shown above where you want to give your app a stylized background, though this technique applies equally well to smaller areas where you want to add texture to a UI control. Simply set the background color of the desired view to a patterned color like this:

view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"pattern.png"]];

The view now will have a textured background that scales and adjusts with the size of the view. A good source for textures that tile well is the Subtle Patterns project.

Use stretched images

UIImage includes a performant method of creating images that scale dynamically with size. The image is setup so that the middle section stretches keeping the edges unchanged. This is often used for things like buttons where the corners and sides are styled but the body of the button is plain. I also works well for creating an ‘etched’ effect in table views (like in the App Store example above). Here rather than creating a 320x48 image that represents the cell background you create a tiny 1x3 image with the desired top, body and bottom colors desired. This is then assigned as your backgroundView resulting in the effect shown.

UIImage* template  = [UIImage imageName:@"template.png"];
UIImage* stretched = [template resizableImageWithCapInsets:UIEdgeInsetsMake(1, 0, 1, 0)]
cell.backgroundView = [[UIImageView alloc] initWithImage:stretched];
0
On

you need to use image Assets in you app. Add all images in Assets.xcassets file.