Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 3    Views: 89

MobiGeni
Aspiring developer
Profile
Posts: 65
Reg: Jan 09, 2013
Akersloot
1,350
12/06/15 04:09 AM (8 years ago)

Button Menu Advertising

Hi, I've added the Button Menu plugin to my screens. I was wondering how we can Enable Advertising option. I've added the includeAds":"1" to the json but it does not show the iAds banner. Is it possible?
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
12/06/15 04:43 AM (8 years ago)
It may or may not be present in 'all' plugin code... but the support is really elsewhere in the BT core, so what you might want to try is to paste THIS: //create adView? if([[BT_strings getJsonPropertyValue:self.screenData.jsonVars nameOfProperty:@"includeAds" defaultValue:@"0"] isEqualToString:@"1"]){ [self createAdBannerView]; } as the last bit of code in the 'viewDidLoad' method, typically located at the start of your plugin 'implementation' (m) file. Good Luck! Cheers! -- Smug
 
MobiGeni
Aspiring developer
Profile
Posts: 65
Reg: Jan 09, 2013
Akersloot
1,350
like
12/06/15 06:06 AM (8 years ago)
Thanks Smug, but It seems not to work. This is what I did and pasted into the ViewDidLoad function in BT_screen_menuButtons.m //viewDidLoad -(void)viewDidLoad{ [BT_debugger showIt:self theMessage:@"viewDidLoad"]; [super viewDidLoad]; //init screen properties [self setDidInit:0]; self.buttonSize = 60; self.buttonPadding = 15; self.buttonLayoutStyle = @"grid"; self.buttonLabelLayoutStyle = @"bottom"; self.buttonLabelFontColor = [UIColor lightGrayColor]; self.buttonLabelFontSize = 13; self.isLoading = FALSE; NSString *stringOpacity = @"1.0"; //appDelegate racinggame_appDelegate *appDelegate = (racinggame_appDelegate *)[[UIApplication sharedApplication] delegate]; self.deviceWidth = [appDelegate.rootDevice deviceWidth]; self.deviceHeight = [appDelegate.rootDevice deviceHeight]; //add the content views..they get resized and updated in layoutScreen method self.myScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, deviceWidth, deviceHeight)]; [self.myScrollView setShowsVerticalScrollIndicator:FALSE]; [self.myScrollView setShowsHorizontalScrollIndicator:FALSE]; [self.myScrollView setDelegate:self]; self.myScrollView.autoresizingMask = (UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth); //prevent scrolling? if([[BT_strings getStyleValueForScreen:self.screenData nameOfProperty:@"preventAllScrolling" defaultValue:@""] isEqualToString:@"1"]){ [self.myScrollView setScrollEnabled:FALSE]; } //opacity stringOpacity = [BT_strings getStyleValueForScreen:self.screenData nameOfProperty:@"buttonOpacity" defaultValue:@"100"]; if([stringOpacity isEqualToString:@""]) stringOpacity = @"100"; //layout style self.buttonLayoutStyle = [BT_strings getStyleValueForScreen:self.screenData nameOfProperty:@"buttonLayoutStyle" defaultValue:@"grid"]; self.buttonLabelLayoutStyle = [BT_strings getStyleValueForScreen:self.screenData nameOfProperty:@"buttonLabelLayoutStyle" defaultValue:@"below"]; //font color self.buttonLabelFontColor = [BT_color getColorFromHexString:[BT_strings getStyleValueForScreen:self.screenData nameOfProperty:@"buttonLabelFontColor" defaultValue:@"#CCCCCC"]]; //convert button opacity self.buttonOpacity = [stringOpacity doubleValue] / 100; //some settings depend on the device size if([appDelegate.rootDevice isIPad]){ //use large settings self.buttonSize = [[BT_strings getStyleValueForScreen:self.screenData nameOfProperty:@"buttonSizeLargeDevice" defaultValue:@"60"] intValue]; self.buttonLabelFontSize = [[BT_strings getStyleValueForScreen:self.screenData nameOfProperty:@"buttonLabelFontSizeLargeDevice" defaultValue:@"13"] intValue]; self.buttonPadding = [[BT_strings getStyleValueForScreen:self.screenData nameOfProperty:@"buttonPaddingLargeDevice" defaultValue:@"15"] intValue]; }else{ //use small settings self.buttonSize = [[BT_strings getStyleValueForScreen:self.screenData nameOfProperty:@"buttonSizeSmallDevice" defaultValue:@"60"] intValue]; self.buttonLabelFontSize = [[BT_strings getStyleValueForScreen:self.screenData nameOfProperty:@"buttonLabelFontSizeSmallDevice" defaultValue:@"13"] intValue]; self.buttonPadding = [[BT_strings getStyleValueForScreen:self.screenData nameOfProperty:@"buttonPaddingSmallDevice" defaultValue:@"15"] intValue]; } //add the scrollview [self.view addSubview:myScrollView]; //create adView? if([[BT_strings getJsonPropertyValue:self.screenData.jsonVars nameOfProperty:@"includeAds" defaultValue:@"0"] isEqualToString:@"1"]){ [self createAdBannerView]; } }
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
12/06/15 06:47 AM (8 years ago)
And it works in other plugins? Cheers! -- Smug
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.