If you add the view of a UITabBarController as subview to another view controller. When you tap the tab bar to swap in a new view, viewWillAppear of that view's controller will not be called. This causes problem because many times you use viewWillAppear to refresh a view managed by UITabBarController.
One workaround is to subclass UIView for the view you want to update, and move the stuff from viewWillAppear to drawRect.
Monday, November 29, 2010
Saturday, November 27, 2010
The Simplest Way to Add iAd Banner to Your iPhone Application
It is a bad idea to modify each view controller to add iAd banner. The simplest way to do that is to create a new root view controller and add an AdBannerView and your old root view to it. Do it in your application delegate:
[rootVC.view addSubview:oldRootVC.view];
ADBannerView *adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifier320x50;
adView.frame=CGRectMake(0, 0, 320, 50);
AdVC* rootVC = [[AdVC alloc] initWithNibName:@"AdVC" bundle:nil];
[window addSubview:rootVC.view];
[rootVC.view addSubview:oldRootVC.view];
[rootVC.view addSubview:adView];
rootVC.view.frame = window.screen.applicationFrame;
oldRootVC.view.frame=CGRectMake(0, 50, 320, 480-50-20);
This will add a banner to all of your views, and it also allows you to easily remove the banner if the user choose to upgrade.
This will add a banner to all of your views, and it also allows you to easily remove the banner if the user choose to upgrade.
How to fix status bar covering UIView
Sometime it is annoying that the status bar covers your UIView, and there are various other problems about the view location.
A simple fix is
rootVC.view.frame = window.screen.applicationFrame;
A simple fix is
rootVC.view.frame = window.screen.applicationFrame;
Xcode error: No launchable executable present at path
If this error shows up after the name of the executable changes in Xcode, restarting Xcode could solve this problem.
Monday, November 22, 2010
Cocos2d v0.99.5-rc1 not working with Xcode 3.2.4
There are lots of compilation errors using the default project file of cocos2d v0.99.5-rc1 with Xcode 3.2.4.
Use gcc or llvm-gcc instead of llvm, then it is OK.
Use gcc or llvm-gcc instead of llvm, then it is OK.
How to Enter Copyright Symbol in Inkscape
When inputing text, press Control to enter Unicode, then enter 00a9 for copyright symbol.
Monday, November 15, 2010
Massage Map 3D is ready for sale in iPhone App Store.
Acupressure is a form of massage based on acupuncture points. Ancient Chinese found that stimulating special locations on the human body can relieve pain or ailments. These special locations are called acupuncture or acupressure points.
Massage Map 3D is the first software to provide an accurate and clear three dimensional map of all important acupressure points on human body. It is useful to people who are new to acupressure and also professional massage therapists.
The features include:
- Uses standard acupressure point code names based on authoritative acupressure and acupuncture books
- Includes both English and Chinese pinyin names for acupressure points
- Click an ailment to find the acupressure points that relieve it
- Ailments are organized by body parts or systems
- Browse acupressure points by code names
- The location of acupressure points are based on authoritative acupressure and acupuncture books
- The 3D human body can be rotated, moved and zoomed-in for better view of the acupressure points
- Includes detailed and professional instructions about how to locate the acupressure points
- Integrated with web search and wikipedia for images and webpages of acupressure points, anatomical and medical terms
- Includes basic instructions about how to locate acupressure points and perform acupressure
Massage Map 3D is now ready for sale in iPhone App Store.
Massage Map 3D is the first software to provide an accurate and clear three dimensional map of all important acupressure points on human body. It is useful to people who are new to acupressure and also professional massage therapists.
The features include:
- Uses standard acupressure point code names based on authoritative acupressure and acupuncture books
- Includes both English and Chinese pinyin names for acupressure points
- Click an ailment to find the acupressure points that relieve it
- Ailments are organized by body parts or systems
- Browse acupressure points by code names
- The location of acupressure points are based on authoritative acupressure and acupuncture books
- The 3D human body can be rotated, moved and zoomed-in for better view of the acupressure points
- Includes detailed and professional instructions about how to locate the acupressure points
- Integrated with web search and wikipedia for images and webpages of acupressure points, anatomical and medical terms
- Includes basic instructions about how to locate acupressure points and perform acupressure
Massage Map 3D is now ready for sale in iPhone App Store.
Sunday, November 14, 2010
Problem printing double with printf on iPhone
On other platforms, it usually does not matter whether you use %g or %lg to print double with printf, but for iPhone, you have to use %lg.
Saturday, November 13, 2010
sed for iphone
Here is a simple sed for iphone using RegexKitLite:
// input - input string
// search - regex to search
// replace - string to replace with
// return value - output string
Search the web for RegexKitLite:
For documentation of regex, see http://userguide.icu-project.org/strings/regexp
// input - input string
// search - regex to search
// replace - string to replace with
// return value - output string
const char* sed(const char* input, const char* search,const char* replace) {
static char buf[100000]; // assume the output string length <100000
NSString *searchString = [NSString stringWithFormat:@"%s",input];
NSString *regexString = [NSString stringWithFormat:@"%s",search];
NSString *replaceWithString = [NSString stringWithFormat:@"%s",replace];
NSString *replacedString = NULL;
replacedString = [searchString stringByReplacingOccurrencesOfRegex:regexString withString:replaceWithString];
NSLog(@"replaced string: '%@'", replacedString);
strcpy(buf, [replacedString UTF8String]);
return buf;
}
sample usage:
char* buf = sed (str, "[ \\t]+", " "); // replace multiple white spaces with one space
// note you need double \\
To use it, you need to
1. download RegexKitLite
2. add RegexKitLite.h and RegexKitLite.m to your Xcode project
3. add libcucore.dylib to Frameworks of your Xcode project
Search the web for RegexKitLite:
For documentation of regex, see http://userguide.icu-project.org/strings/regexp
Subscribe to:
Posts (Atom)