Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 6    Views: 44

NCbuzz
Code is Art
Profile
Posts: 575
Reg: Sep 11, 2013
Lillington, NC
11,100
02/19/15 07:09 PM (9 years ago)

How to determine what BT screen is displayed?

I know I have seen this topic, but can't find anywhere. I am using a plugin with multiple screens that have been duplicated. Would like to determine what the current screen is by either 'itemNickname' or 'itemId', and then execute different code... How would I leverage BT core to replace"theScreen" in code below: if([[theScreen itemNickname] isEqualToString:@"my_screenName"]){ Thanks!
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
02/19/15 07:45 PM (9 years ago)
https://www.buzztouch.com/forum/thread.php?tid=C3CD6339BF4B17B02DFEF7D&currentPage=1 check out the post above if your trying to load a certain screen. Why wouldnt it replace the screen depending on what json reads like usual?Im confused.hope that link helps though
 
NCbuzz
Code is Art
Profile
Posts: 575
Reg: Sep 11, 2013
Lillington, NC
11,100
like
02/19/15 08:09 PM (9 years ago)
Thanks for the info- sure I can use it. What I am looking for now is to know what the current screen is. (basing what code to run based upon which screen version of the plugin I am in)
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
02/19/15 08:17 PM (9 years ago)
Along with Chris' good information, you can find out what the actual nickname for the current screen by doing something like this: NSString *myScreenNickName = [[NSString alloc]initWithString:[BT_strings getJsonPropertyValue:self.screenData.jsonVars nameOfProperty:@"itemNickname" defaultValue:@""]]; Then, when you need the name, you can use your local property 'myScreenNickName' (or whatever you actually call it when you are working in your code). Sadly, objC doesn't handle the 'switch' statement for strings, so if each screen needs something different, you'll have to use 'If (something) {//} else if (something else) {//} else if (something more) {//} else {//}; If it's the same result for all screens, then it shouldn't be too hard. Cheers! -- Smug
 
NCbuzz
Code is Art
Profile
Posts: 575
Reg: Sep 11, 2013
Lillington, NC
11,100
like
02/19/15 08:44 PM (9 years ago)
Worked perfect - just what I needed. Thanks!!
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
02/20/15 01:41 AM (9 years ago)
Try not to over complicate, every screens information is stored in a BT_item you can access all of the screen from self.screendata itemId, itemNickname, itemType , jsonVars NSString *screenNickname = self.screendata.itemNickname if(screenNickname isEqualToString:@"my_screenName"]){...} or directly if(self.screendata.itemNickname isEqualToString:@"my_screenName"]){...}
 
NCbuzz
Code is Art
Profile
Posts: 575
Reg: Sep 11, 2013
Lillington, NC
11,100
like
02/20/15 10:27 AM (9 years ago)
Thanks! Will try tonight. Anything to save wear and tear on my keyboard;)
 

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.