Discussion Forums  >  Uncategorized

Replies: 1    Views: 301

baywebnz
Aspiring developer
Profile
Posts: 92
Reg: Oct 25, 2010
location unknow...
920
07/23/11 02:52 PM (14 years ago)

Custom Plug-in - iOS v1.5 (@David)

Hi David, Just noticed that in the v1.5 documentation there are details about a custom plug-in screen. However there is no option to select this in the screens and menus. This is something I would be very interested in having a look at. Should it already be available? or is it still in development for release further down the line? Thanks as always.
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
07/23/11 06:46 PM (14 years ago)
Good question: The iOS source-code supports this now. We have not found a good way to integrate this into the cotrol panel becase there isn't anyway for us to know what type of screen (plug in) you are building. Try this and see if you can figure it out: a) Create a test app and add a menu with a few items. b) Download the code and look at the config data that comes with the project. c) Remove the dataURL property and the reportToCloud property from the BT_config.txt file. This will force the app to not check the server for any updates at this point. We want the app to use the config data in the project, not the config data on the server. c) Copy one of the screen objects in the config data. Paste this to the end of of the list of screens. Be sure to add a comma after the existing screen object and have no comma after the last screen, like it is now. At this point you'll have two screen objects in the list with the same type and the same id and the same options. Change the type of screen you pasted to a BT_screen_plugin. Your new screen object will look like: {itemId:myPlugin, itemType:BT_screen_plugIn, itemNickname:My Custom Screen, classFileName:myCustomPlugin} At this point you have a custom plugin screen object but the menu does not understand how to load it. So, add an item to the menu (again, we are still working in the BT_config.txt file and not in the control panel. For the menu, add a child item that loads your new plugin. Use loadScreenWithItemId:myPlugin. Adding a child item to the menu tells the list what to display and what happens when that item is tapped. In this case, we want to load our custom plugin. Compile and run the project: At this point you shoud see your new menu item in the list. Tapping it should show an error because the app does not understand what a myCustomPlugin is yet. This is the class file you'll need to create. This is where it gets interesting. Creating a new class file file called myCustomPlugin isn't so tough, getting it to do something may be tough depending on your skill. a) In your BT_plugins folder, in Xcode, add a New Item, choose UIViewController as the base class. Name this new class myCustomPlugin. Doing only that should allow the project to load it. The UIViewController will be blank when it loads but it should load. You could then write whatever code you want in that class. This is the custom part. You would probably get some good results by copying the contents of another included class from BT_Screens into your new custom class. Copy both the .h and .m contents with doing this. Be sure to keep the name of your class in .h and .m myCustomPlugin. This would give you a good starting point for creating whatever you want, changing, adjusting, etc. without affecting any other classes in the project. This topic could use a good tuturoial and video but getting a way to do this with the control panel first is a more important we think. Good luck.
 

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.