开发者

Making a lite Version in Xcode 4

I am trying to make a lite version to my iPhone App. I followed this tutorial to the dot and copied the target. Everything there went great but when I enter -DLITE_VERSIONinto the LLVM GCC 4.2 - Language setting in the build tab, the define does not work correctly. When I enter #ifdef LITE_VERSION, I build without errors but yet the button that I am trying to set as hidden is still showing. Any idea's. BTW I change the active scheme by selecting it from the bar right next to the开发者_开发问答 run button on the top left of xcode 4.

Here is my code:

#ifdef LITE_VERSION

    [play setHidden:YES];

#else
    [play setHidden:NO];
#endif


What I did is defined a #define in the -Prefix.pch of my lite version like so:

#define POSTPASSFREE 2

In my 'pro' version I have this #define:

#define POSTPASS 1

I then used conditional compilation, similar to what you have above in those areas where things need to be slightly different:

#if POSTPASSFREE
    return NO;
#else
    return YES;
#endif

Using both:

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
#if POSTPASS
    return 2;
#elif POSTPASSFREE
    return 1;
#endif
}

Switching between schemes will activate the various sections at build time.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜