Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 2    Views: 41

nadthevlad
Code is Art
Profile
Posts: 1025
Reg: Jun 07, 2012
Denver
21,850
02/15/15 12:18 PM (9 years ago)

Trying to find screen by itemType

I am trying to get a reference to a screen by itemType. I know there are helper methods for finding screens by itemId and itemName. Are there any methods that will return BT_item(s) when searching for itemType's?
 
RonBo
buzztouch Evangelist
Profile
Posts: 167
Reg: Feb 26, 2012
Raleigh, NC
5,220
like
02/15/15 01:11 PM (9 years ago)
Not sure this will help, but I use this (admittedly clunky) method to display different AdMob adunits, based on the name of the Tab Bar screen name.... // choose which Smart ad unit to use if([self.screenData.itemNickname isEqualToString:@"m_FreshwaterFishing" ]) { bannerView_.adUnitID = @"ca-app-pub-3892190088072454/2522597324"; } //tab screen "More" if([self.screenData.itemNickname isEqualToString:@"m_settings" ]) { bannerView_.adUnitID = @"ca-app-pub-3892190088072454/432008"; }
 
nadthevlad
Code is Art
Profile
Posts: 1025
Reg: Jun 07, 2012
Denver
21,850
like
02/15/15 01:19 PM (9 years ago)
I can see where that would work. Doing something like: [self.screenData.itemType isEqualToString:@"BT_quiz"] I don't think I have access to self.screendata though. The code I am working with isn't using BT_viewController. I did find a solution though test33_appDelegate *appdelegate = (test33_appDelegate *) [[UIApplication sharedApplication] delegate]; NSMutableArray *screens = appdelegate.rootApp.screens; NSPredicate *predicate = [NSPredicate predicateWithFormat:@"itemType == 'NAD_nadsPlugin'"]; NSArray *filtered = [screens filteredArrayUsingPredicate:predicate]; [BT_debugger showIt:self message:[NSString stringWithFormat:@"Number of items found : %lu", (unsigned long)[filtered count]]]; BT_item *item = [filtered objectAtIndex:0]; [BT_debugger showIt:self message:[NSString stringWithFormat:@"item : %@", item.itemType]];
 

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.