Tutorial

admin on December 13th, 2010

If you have two CLLocations and are wondering how to calculate the distance in between, here is how: CLLocation *location1 = [[CLLocation alloc] initWithLatitude:42.333297 longitude:-71.588858]; CLLocation *location2 = [[CLLocation alloc] initWithLatitude:42.353297 longitude:-71.578858]; float distanceInBetween = [location1 getDistanceFrom:location2]; The code above is deprecated, the new code should look like: CLLocationDistance kilometers; kilometers = [location1 distanceFromLocation:location2] / [...]

Continue reading about Calculate distance between two locations

admin on December 11th, 2010

NSString *str = @”A animal can fly”; str = [str stringByReplacingOccurrencesOfString:@"animal" withString:@"duck"]; Bookmark on Delicious Digg this post Recommend on Facebook share via Reddit Share with Stumblers Tweet about it Subscribe to the comments on this post

Continue reading about NSString replace substring with string

admin on December 11th, 2010

Convert NSData to NSString: NSString *str= @”this is a string”; NSData *data=[str dataUsingEncoding:NSUTF8StringEncoding]; Convert NSData to NSString (ASCII encoding assumed): NSString *str = [NSString stringWithCString:[data bytes] length:[data length]]; Bookmark on Delicious Digg this post Recommend on Facebook share via Reddit Share with Stumblers Tweet about it Subscribe to the comments on this post

Continue reading about Convert a NSString to NSData and NSData to NSString

admin on December 11th, 2010

You need to set a compiler flag.  Go to target then either get Info or double click your target, make sure you have selected the Debug configuration  and look for Other C Flags. (GCC4.2 Language section) Then add the following as a value: -DDEBUG Now you can simply do #ifdef DEBUG NSLog(@”Debug mode running”); #endif [...]

Continue reading about How to include some code only during DEBUG builds

admin on December 10th, 2010

Great tips on .htaccess: http://bit.ly/icNu6C Bookmark on Delicious Digg this post Recommend on Facebook share via Reddit Share with Stumblers Tweet about it Subscribe to the comments on this post

Continue reading about 17 Useful .htacess tricks/tips

admin on December 5th, 2010

Work in progress…. 1) Inside your ViewController.h: #import “AdWhirlView.h” #import “AdWhirlDelegateProtocol.h” 2) @interface ViewController : UIViewController <AdWhirlDelegate>{ //your code 3) Inside your ViewController.m: above the @implementation: #define kSampleAppKey @”yourAdWhirlKey” 4) Inside the @implementation: #pragma mark AdWhirlDelegate methods – (NSString *)adWhirlApplicationKey{ return kSampleAppKey; } – (UIViewController *)viewControllerForPresentingModalView{ return self; } Now for section 7: 5) Inside [...]

Continue reading about Tutorial: integrating AdWhirl into your applications