Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 12    Views: 88

Red Dog
buzztouch Evangelist
Profile
Posts: 805
Reg: Jun 16, 2011
Southern Califo...
18,800
11/14/13 03:42 PM (12 years ago)

looking for help with loading a (non BT) view

I am loading a non BT window, but it overrides the BT_view. In other words, it covers up the BT NavBar instead of showing under it. Here is the offending code: self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; switchViewController = [[SwitchViewController alloc] initWithNibName:@"SwitchViewController" bundle:nil]; self.window.rootViewController = switchViewController; [self.window makeKeyAndVisible]; Any suggestions to get it to load with the BT NavBar ? Thank you.
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
11/14/13 03:47 PM (12 years ago)
From what your showing you are trying to add a third party code/Viewcontroller into a BT project. Think of if this way every plugin is a view controller. Create a custom plugin or use a blank plugin Copy the code from SwitchViewController.m and SwitchViewController.h into the .m and .h files. Launch them as a plugin
 
Red Dog
buzztouch Evangelist
Profile
Posts: 805
Reg: Jun 16, 2011
Southern Califo...
18,800
like
11/14/13 04:37 PM (12 years ago)
Thanks Andy. I tried that first, and got basically the same result. It runs fine, but no way to return to my menu since the BT Nav Bar is covered.
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
11/14/13 04:42 PM (12 years ago)
In the .h file did you change the subclass from Uiviewcontroller to Bt_viewcontroller that controls the navbar
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
11/14/13 04:42 PM (12 years ago)
Should say superclass
 
Red Dog
buzztouch Evangelist
Profile
Posts: 805
Reg: Jun 16, 2011
Southern Califo...
18,800
like
11/14/13 04:49 PM (12 years ago)
@interface my_plugin : BT_viewController <UIApplicationDelegate>{ Where should it say superclass?
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
11/14/13 04:54 PM (12 years ago)
That's in the right place. It's hard without seeing the code in the project.
 
mrDavid
BTMods.com
Profile
Posts: 3936
Reg: May 21, 2011
San Diego, CA
51,910
like
11/14/13 05:48 PM (12 years ago)
and you just ported code into a plugin. You rock. David https://buzztouchmods.com/market
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
11/15/13 12:48 AM (12 years ago)
// Here is the offending code: self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; switchViewController = [[SwitchViewController alloc] initWithNibName:@"SwitchViewController" bundle:nil]; self.window.rootViewController = switchViewController; [self.window makeKeyAndVisible]; // -------- So, here's the issue as I see it. You are trying to load a new viewController, but loading it as your "rootViewController". This basically adds a primary screen on top of your other primary screen. Buzztouch already has a rootViewController in place, and the plugins are on top of that. Try something like this: switchViewController = [[SwitchViewController alloc] initWithNibName:@"SwitchViewController" bundle:nil]; [self.navigationController switchViewController animated:YES]; This should add the "switchViewController" (presumably a custom class file you have in your project) into memory and then push it onto view. In terms of covering "up the BT NavBar instead of showing under it", this will still happen. That's because the navigation bar is just a view presented by the code for the class file. If you have access to the switchViewController.m file, you could add in code to the viewWillAppear method similar to what is in other Buzztouch plugins to bring up the nav bar. That is: [BT_viewUtilities configureBackgroundAndNavBar:self theScreenData:[self screenData]]; You'll need to also include the proper #import statement (that is, "#import "BT_viewUtilities.h"). Alternatively, you should be able to add similar code as the "configureBackgroundAndNavBar" method right after the switchViewController method, replacing "theViewController" for "switchViewController", etc. If you don't have the .m file available (as in it's a packaged SDK), you'll need to go about it this way. Otherwise, it's easier to go with the first approach.
 
Red Dog
buzztouch Evangelist
Profile
Posts: 805
Reg: Jun 16, 2011
Southern Califo...
18,800
like
11/15/13 04:12 PM (12 years ago)
Thanks Chris and Andy. Something is just not right. No luck with any of this. Did I mention these are .xib files? No, I didn't. Does that matter? Maybe I can add a button to the xib pointing back to my BT menu screen?
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
11/15/13 11:52 PM (12 years ago)
If you'd like, place your project on Dropbox and send me a share link. I'll take a look.
 
Red Dog
buzztouch Evangelist
Profile
Posts: 805
Reg: Jun 16, 2011
Southern Califo...
18,800
like
11/16/13 08:05 AM (12 years ago)
Hi Chris. I shared a folder with you. the plugin is far from ready for prime time. Please don't spend any time on other issues. :-)
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
11/16/13 09:44 AM (12 years ago)
You should be good now. You don't need the "Rd_memory_game" files anymore. The new JSON looks like: {"itemId":"314633FAAA1497573BF5F4A", "itemType":"SwitchViewController", "itemNickname":"Game", "navBarTitleText":"Game", "navBarStyle":"hidden"}
 

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.