iOS a project to implement multiple target

Source: Internet
Author: User

Our company's project needs to involve many cities, most functions are the same, but each city has its own characteristics, the most basic is the app icon and launchimage different, so we should understand ...

Use multiple target In fact, there are many scenes, such as the United States and the buyers of the buyer and seller side, drop of passengers and drivers, boss directly employed cattle and recruitment end, can be implemented in such a way, not only save a lot of time, but also improve the efficiency of development ...

Demo Address: Click on the Open link

Next, I will be from a demo to give you a detailed analysis of ...

1. Create Project

First, we need to create a project as usual,


My name is Multi-targetdemo, the following figure:


2. Create a new target


Select Single View application


Have a name like project


When we're done, we can see


3. The common function is realized in Multi-targetdemo, Target2 has its own characteristics.

The requirement is Multi-targetdemo implementation view is red, Target2 realize view is a simple blue function.


The first thing to do is Appdelegate association Taget2


The second is to Target2 appdelegate in the appdelegate to change the name and inherit and Appdelegate, the implementation of the initialization of the parent class ~




At this point we are basically finished with the association.

So how do we differentiate two target?

4. Tips for distinguishing target

This place I wrote wrong, Debug and release need to define, otherwise production will be an error.


How to use.


Run different target, come out different effects,


It's OK ~

If there is any shortage, please correct your friend. Thank you.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.