Hey, sports!
Today the time is really really short, so I made an example and uploaded it.
It's no a virus or anything, it's a project that can help you when you need to make action like this:
1)Press button;
2)Wish that it would increase/decrease a "number label";
3)Release button;
4)Action stop right after releasing
here's the link:
Project: Button Press&Hold
Hasta la vista, dudes.
Thursday, October 6, 2011
Monday, October 3, 2011
AdMob/Cocos2D: How to implement Admod using Cocos2D
How's it going, bros?
Here's another post for those who want to try to make some money with Ads, specifically with AdMob - Google solutions for apps in your mobile application.
If you're just looking for the standard stuff for a UIViewController you can go directly to the GoogleCode page:
http://code.google.com/mobile/ads/docs/ios/fundamentals.html
Real easy instructions, almost thought that they should put on the title: "AdMob implementation for Dummies" (that's why i used :) ).
But if you are a avid Cocos2D programmer and are cracking you head of testing your options and not getting a good tutorial here it goes:
*Using: Cocos2D 1.0.1
1)Follow Google's link instructions till the part it shows the ".h" file;
2) Include what's not there:
//MyCoolApp.h
GADBannerView *bannerView_;
}
//MyCoolApp.m
//AdMob code
//best practice for removing the barnnerView_
3)Just be happy!
Hope this helps you guys, if you have any problems just get in contact.
Here's another post for those who want to try to make some money with Ads, specifically with AdMob - Google solutions for apps in your mobile application.
If you're just looking for the standard stuff for a UIViewController you can go directly to the GoogleCode page:
http://code.google.com/mobile/ads/docs/ios/fundamentals.html
Real easy instructions, almost thought that they should put on the title: "AdMob implementation for Dummies" (that's why i used :) ).
But if you are a avid Cocos2D programmer and are cracking you head of testing your options and not getting a good tutorial here it goes:
*Using: Cocos2D 1.0.1
1)Follow Google's link instructions till the part it shows the ".h" file;
2) Include what's not there:
//MyCoolApp.h
#import "GADBannerView.h"
#import "RootViewController.h"
@interface MyCoolApp : CCLayer {
NSTimer* refreshTimer;
NSInteger elapsedTime;
NSInteger minutes;
NSInteger seconds;
}
@property(nonatomic, retain)NSTimer* refreshTimer;
//YES I DID START THIS METHOD WITH UPPER CASE (:
-(void)AdMob;
-(void)removeSubviews;
-(void)targetMethod:(NSTimer *)theTimer;
//MyCoolApp.m
@synthesize refreshTimer;
//AdMob code
-(void)AdMob{
NSLog(@"ADMOB");
CGSize size = [[CCDirector sharedDirector] winSize];
bannerView_ = [[GADBannerView alloc]
initWithFrame:CGRectMake(0.0, size.height-GAD_SIZE_468x60.height-720,GAD_SIZE_468x60.width,GAD_SIZE_468x60.height)];
bannerView_.adUnitID = @"BUNCH_OF_NUMBERS_ADMOB_GIVES_YOU";
bannerView_.rootViewController = self;
[[[CCDirector sharedDirector]openGLView]addSubview:bannerView_];
[bannerView_ loadRequest:[GADRequest request]];
}
//best practice for removing the barnnerView_
-(void)removeSubviews{
NSArray* subviews = [[CCDirector sharedDirector]openGLView].subviews;
for (id SUB in subviews){
[(UIView*)SUB removeFromSuperview];
[SUB release];
}
}
//this makes the refreshTimer count
-(void)targetMethod:(NSTimer *)theTimer{
//INCREASE OF THE TIMER AND SECONDS
elapsedTime++;
seconds++;
//INCREASE OF THE MINUTOS EACH 60 SECONDS
if (seconds>=60) {
seconds=0; minutes++;
[self removeSubviews];
[self AdMob];
}
NSLog(@"TIME: %02d:%02d", minutes, seconds);
}
-(id)init{
if( (self=[super init])) {
refreshTimer = [NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(targetMethod:) userInfo:nil repeats:YES];
[self AdMob];
}
return self;
}
3)Just be happy!
Hope this helps you guys, if you have any problems just get in contact.
Subscribe to:
Posts (Atom)