Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAndrew Barber
3,865 PointsQR Code Application Advice
Hey Guys,
I am trying to create an iphone application that is similar to RedLaser. I was wondering if someone could give me advice on how you would create the UI when the barcode has been scanned.
Example:
The following image shows what happens when you scan the Nutrigrain barcode. It shows the image, title, and there are even buttons to add to favourites and a list all information is contained within the application and not sent to the safari app:
I like the way how it is all contained within the application and I would like to do something like this. I'm pretty stuck on understanding how to tell the application what to do once a code has been scanned instead of opening straight to safari like a normal website, and how to code the UI to do this
Thanks!
3 Answers
Patrick Cooney
12,216 PointsThere shouldn't be a "default" action. You can tell it what to do once it receives the bar code info. To show it in-app you'd probably have to have a database with an API that could pull information from the DB without needing to go to a webpage. You can then use the returned JSON or (XML) to populate the information of your app in your view controller. This is all assuming when you say you don't want it to open Safari you mean you don't even want to use a webview (which is like safari only on the area of the screen you tell it to occupy.).
Patrick Cooney
12,216 PointsDon't.
Andrew Barber
3,865 Pointslol. I dont have a choice plus it's something I want to do for a good cause. I just need to understand how I can create this section of the application.
Andrew Barber
3,865 PointsNo Worries.
With your advice, I managed to get this all up and running with JSON and sending it through to the app I designed.
Thanks again!
Andrew Barber
3,865 PointsAndrew Barber
3,865 PointsThanks Patrick.
I managed to create a DB in mySQLWorkbench and now i need to look into JSON as you mentioned above. Do you know if there are any tutorials on this?
Patrick Cooney
12,216 PointsPatrick Cooney
12,216 PointsSorry, I was in Puerto Rico last week and early this week and had a pretty spotty internet connection.
Some of the projects on Treehouse utilize JSON. I would go through all the iOS projects here if you haven't already. I'm willing to bet a lot of your questions would be answered. Also the self destructing message app uses a service that does all the database maintenance for you. It might be worth checking out that project and trying to adapt it to your needs.
Andrew Barber
3,865 PointsAndrew Barber
3,865 PointsNo Worries.
With your advice, I managed to get this all up and running with JSON and sending it through to the app I designed.
Thanks again!