Use this : - (void)blinkAnimation:(NSString *)animationId finished:(BOOL)finished target:(UIView *)target { if (shouldContinueBlinking) { [UIView beginAnimations:animationId context:target]; [UIView setAnimationDuration:0.5f]; [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(blinkAnimation:finished:target:)]; if ([target...
UIButton setfont is depreciated
As UIButton exposes its titleLabel starting from iPhone OS 3.0 you must set font to it directly:
[button.titleLabel setFont:[UIFont boldSystemFontOfSize:15]];
Check String Contains in objective-c / xCode / iPhone
NSString *string = @"hello World";
if ([string rangeOfString:@"World"].location == NSNotFound) {
NSLog(@"string does not contain World");
} else {
NSLog(@"string contains World!");
}
How to get sprite animation frames using spritesheet in cocos2d
if you are using SpriteSheet for animation,you can extract all required frame like this… [[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"spritesheet.plist"]; CCSpriteBatchNode *spriteSheet = [CCSpriteBatchNode batchNodeWithFile:@"spritesheet.png"]; [self addChild:spriteSheet]; NSMutableArray *frames = [[[NSMutableArray alloc]init]retain]; for(int...
How to manage application when orientation changes?
The problem is that when you rotate the device then (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation Method gets called but when you go to the next screen then this method does not get called. if you rotate your device again then that method gets called. So if you want to change next screen orientation as device current orientation, then check the...
For finding touch location on screen in cocos2d (ios)
Try This code and get touch location in cocos2d (ios)
- (void)ccTouchesBegan:(NSSet*)touches withEvent:(UIEvent*)event
{
UITouch *myTouch = [touches anyObject];
CGPoint location = [myTouch locationInView:[myTouch view]];
location = [[CCDirector sharedDirector] convertToGL:location];
}