Discussion Forums  >  Uncategorized

Replies: 7    Views: 387

ByFred
Code is Art
Profile
Posts: 51
Reg: Aug 26, 2011
New York
510
10/25/11 03:26 PM (14 years ago)

Custom view with json data, looking for a tutorial

I want to make a custom view (plugin) for making some screen that getting there data from a json file... something like this screen http://www.cnqar.com/templates/images/screenshots/attack_city.png Does anybody knows how to do this or know a nice tutorial... need some push in the right direction
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
10/26/11 01:22 AM (14 years ago)
Hi in NY. Hard to guess what you're doing that's 'like' the screen in the image. I'm not much of a gamer and can't really understand what dropping bombs does. Funny. No matter, data is data. So, the there will be a few steps to this. I'll try to explain an approach in the simplest terms I can. Not sure how much understanding you have of all this stuff? I'll also assume you're working with iOS. The concepts are basically the same for iOS and Android... a) check your email. I sent you two files, dropBomb.h, dropBomb.m. I have access to user accounts and got our email address from our database. b) Add both of these files to the BT_Plugins folder in the project you downloaded from your control panel. c) In Xcode, use the 'Add Files' option on the BT_plugins folder (control click the folder in Xcode) then navigate to the folder you saved your downloaded project / files to. Add the two files I email you. dropBombs.h, dropBomb.m to the project. At this point both are in the Xcode project. d) In your control panel, create a Custom Plugin sreen. In the classFileName data (in the JSON in the control panel) enter dropBombs as the classFileName e) Connect this custom plugin to a button. f) Compile, run your app At this point your custom plugin should load. It won't do much, it's just a blank screen. But, you've got your first plugin running. Whoo Hoo. After this, you'll need to design some logic into this. Generally speaking, you'll be adding some UI controls (buttons, labels, images) to the UIViewController's view. You'll want to do this be creating a few other methods in the view controller. Methods like viewDidLoad, viewWillAppear, etc. See some other class files for examples of how UI Controls are added to the other types of screens. Add all your controls in the viewDidLoad method. It's usually best to add all the controls, get it to look right, then worry about the data. You'll probably want to figure out how to connect UIButtons that you add to the screen to custom action you write. Methods like dropBomb, increaseScore, playSound, etc. There isn't any limit to this. Pressing buttons triggers actions. What happens after that is limitless. Sending scores to a URL, downloading data, etc. Tough to say what you're up to. Lastly: Up to this point you really haven't done much with any JSON, the title of your post. Aside from some basic JSON in the BT_config.txt file that you created when you created the cusotm plugin screen, you really aren't using any other JSON. You could introduce new JSON data points in the control panel to then use in the view controller but don't even consider this until you get your screen looking they way you want. Just no sense it trying to understand too much all at once ;-) hope this helps
 
ByFred
Code is Art
Profile
Posts: 51
Reg: Aug 26, 2011
New York
510
like
10/26/11 02:46 AM (14 years ago)
Thank you David! This helped me with step one! I managed to load the 'dropBomb' custom plugin, and bind it to a cell action tableview, (user getting a list with cities and they can attack the city they click on). This is so nice now I have a really good idea how to use and make a new custom plugin view! thanks. the screen is now 'attackCity' dropBomb is an action later in the screen(shot), dropBomb is gone be an trigger action, URL call and get response... I think that will be the easiest... The hard part is that I have to load the city Data (JSON) into this screen and make it look like the screenshot, and give the attack buttons to a user that is logged in, otherwise only give some city data. Making the JSON data on serverside PHP is no problem, but the read/receive data I don't get it... yet, so if you can help me with that I can manage the rest, I think!! ;-) Fred
 
mysps
Code is Art
Profile
Posts: 2082
Reg: May 14, 2011
Palma
33,320
like
10/26/11 04:42 AM (14 years ago)
Nice info David. What exactly is contained in the dropBomb.m & .h files? i want to create plugins but not sure exactly where to begin with those files!
 
ByFred
Code is Art
Profile
Posts: 51
Reg: Aug 26, 2011
New York
510
like
10/26/11 01:16 PM (14 years ago)
David, iOS is the biggest one and I understand some steps in custom development, if you have the time can you give me some more info about how to use the json data that's on my server... The problem is I think thats its like building the HTML screen (see screenshot), but I like your approach to give me easy steps in front! Created already 3 custom plugin screens for now, that I need to fill up with json data and give it an design.
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
10/26/11 02:52 PM (14 years ago)
I'll add some comments to this thread later....can't this afternoon - buried! @ mysps: I'll send you the same files I sent @ByFred (simply empty class files to start with) so you can follow along. Expect this later in your inbox.
 
ByFred
Code is Art
Profile
Posts: 51
Reg: Aug 26, 2011
New York
510
like
10/26/11 03:23 PM (14 years ago)
Hi David, I understand, hope to see it soon, we know that you are busy! ;-) Keep up the great work! Fred
 
mysps
Code is Art
Profile
Posts: 2082
Reg: May 14, 2011
Palma
33,320
like
10/26/11 03:37 PM (14 years ago)
Thanks David looking forward to it!!
 

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.