Steps 1) Create Master-Detail Application & Replace the MasterViewController First we want to create a Master-Detail Application just because it sets up a Master-Detail relationship even though thats the first thing we are going to break :). So go ahead and create a new project in XCode4 based on a Master-Detail Application type. Use ARC, Storyboards and CoreData because we will use CoreData to store information. Your storyboard should look like this: Now select the Master scene until its highlighted in blue and delete it with the Delete key. We simply replace it by dragging in a UICollectionViewController onto the storyboard in its place. This places a UICollectionViewController scene with… Read More
Continue ReadingiOS7 – UIKit Dynamics
iOS7 Series – UIKit Dynamics Incorporating UIKitDynamics into your app is pretty simple! The great thing about it is that you really get the most bang for your buck because the end result has a really big WOW Factor which is certain to impress your users. Let’s take a quick conceptual drive around UIKitDynamics. First we adopt the protocol into the ViewController which will implement UIKitDynamics, why? Well because the objects which will be animated in the end will have to send back a lot of signals like “Hey, I collided with a boundary” or “hey I just hit somebody else and I was going this fast, in this… Read More
Continue ReadingHow to create an app – Not programmatically
A fellow coder asked: “How does one go about developing an app from scratch? Where does one start?” My response follows: Some will say its a matter of style and you have to find your own. And eventually you will, after a lot of copy-paste programming. I started in 2009 and my first app was a copy-paste of a few different projects. All the app did was connect to the Internet, download XML and parse it into a uilabel. Then I decided to look into more complex app samples. So I downloaded a few from Apple. In particular I remember iPhoneCoreDataRecipes. In hindsight, it was too complex for a beginner… Read More
Continue ReadingStatic Libraries in iOS – Video Tutorial
Libraries is another one of those rather obscure topics for newbie programmers, kinda like Blocks and Delegates/Protocols. Think of libraries as just that, a resource you can use which doesn’t belong to you. A loaner 🙂 NOTE: If you need a nice tutorial on Blocks or Delegates, check out: Video Tutorial: Objective-C Blocks Video Tutorial: Objective-C Protocols and Delegates Ok back to our tutorial! Well a library is a piece of code that you can use (by importing it into your projects) but its not yours, so you can’t really do what you want to that piece of code, except use its functionality. In this tutorial we will create our… Read More
Continue ReadingPassing Data Example
Delegates or Properties, take your pick. PROPERTIES Class A (ViewController) wants to communicate with Class B (ViewController) Before calling Class B, do the following: In Class B, create a @property NSString* receivedValue; In Class A, #import Class B then in the method that calls B (either prepareForSegue or didSelectRowAtIndexPath or some method where you present Class B view controller, do the following: Class B *calledVC = alloc/init calledVC.receivedValue = ‘whatever value you want to pass’; then call Class B VC Done! DELEGATES Let’s say Class B wants to notify Class A that something has finished. In Class B add this above your @interface: @protocol YourDelegateProtocol <NSObject> – (void)itemWillBePassed; @end… Read More
Continue ReadingDelegates & Protocols iOS
A complex subject to wrap your head around, i agree! But its pretty cool once you get a working example going. Let’s think of a game where a lander comes down from the sky (presumably on Mars – since Mars is a hot topic lately) and deploys a rover. In Cocos2d, you put all your objects on a Layer object. This means the layer class is the main class (analogous to a viewcontroller class contains buttons, views, labels, cells etc). You create a Lander object class because you want to re-use it everywhere in the game. With every new level, you must create a new layer class but you can… Read More
Continue Reading