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.