Search code examples
iosobjective-cc-preprocessortargets

Manage single screen for two targets iOS


I have an app with two targets. Both targets are sharing some resources and some resources are different.

Everything is fine until, I have a screen where I ask user for some info i.e. his date of birth, but it is not required in other target.

So how I can manage it that if user is using app with target1, he will not see date of birth text field but when user is using with target2, app will ask for date of birth.

I am using preprocessors in my .pch to determine which target is used.


Solution

  • You can set flag value and using this you can hide your view in coding part.

    if(target2)
        {
            [self.textField setHidden:YES];
        }else{
            //DO what ever you want
        }