Welcome to Leetr.com Blogs. This is your first post. Edit or delete it, then start blogging!
Welcome to Leetr.com Blogs. This is your first post. Edit or delete it, then start blogging!
Add the following code to your UIWebViewDelegate:
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
if (navigationType == UIWebViewNavigationTypeLinkClicked) {
[[UIApplication sharedApplication] openURL:request.URL];
return false;
}
return true;
}
Add ‘AudioToolBox’ framework
//import the necessary files
#import
// Vibrates the phone
- (void)vibratePhone {
AudioServicesPlaySystemSound (kSystemSoundID_Vibrate);
}
This one is easy to. Change the ‘Bundle display name’ value in the Info.plist file.
Using custom fonts is not the most straight forward thing on the iPhone. Luckily good people at Zynga developed an easy to use FontLabel class. Download it here. Add the files to your project.
Step 1. Import the FontLabel header:
#import "FontLabel.h"
Step 2. Create a label.
//note the name of my font file is 'Rage italic.tty' FontLabel *label = [[FontLabel alloc] initWithFrame:CGRectMake(10, 10, 210, 110) fontName:@"Rage Italic" pointSize:30.0f]; //set the color label.textColor = [UIColor colorWithRed:0.254 green:0.216 blue:0.078 alpha:1]; //set the text label.text = @"Denis you're a handsome man!"; //skip the background. make it transparent label.backgroundColor = nil; label.opaque = NO; label.lineBreakMode = UILineBreakModeTailTruncation; //dynamic number of lines label.numberOfLines = 0; //text alignment label.textAlignment = UITextAlignmentCenter; //add to where you need it [myView addSubview: label]; //and release it [label release];
Couldn’t be easier. Just make sure that degrees are in radians.
imgView.transform = CGAffineTransformMakeRotation (degrees);
You can spice it up with animation:
[UIView beginAnimations:@"rotateAni" context:nil]; //set the duration to 5 seconds [UIView setAnimationDuration:5.0]; imgView.transform = CGAffineTransformMakeRotation (degrees); [UIView commitAnimations];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://phobos.apple.com/WebObjects/your_app_link_here"]];
Put this code right before you run you first scene ( Assuming that you have “Default.png” file ):
// prevent flicker Sprite *sprite = [[Sprite spriteWithFile:@"Default.png"] retain]; sprite.anchorPoint = CGPointZero; [sprite draw]; [[[Director sharedDirector] openGLView] swapBuffers]; [sprite release]; // Run the intro Scene [[Director sharedDirector] runWithScene: introScene];
This is how to get Unix time
[[NSDate date] timeIntervalSince1970];

That all for now, stay tuned for more.