Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Mobile Development > BOOK: Beginning iOS Game Development
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning iOS Game Development
This is the forum to discuss the Wrox book Beginning iOS Game Development by Patrick Alessi ; ISBN: 978-1-1181-0732-4
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning iOS Game Development section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old November 20th, 2013, 10:53 PM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Xcode 5 and Storyboard?!?

Ok first post here we go.

So I was reading the book (obviously the book that this question was posted in) and I just got to the part where Alessi was talking about creating the simple interface application (Pg. 37 if you want to see). Now I have Xcode 5 and if you know anything about that, then you know it doesn't have the check/uncheck storyboard at the start of creating a project, and in the tutorial it says you have to go to the .xib file which isn't there, and I am guessing that is because of storyboard.

Now here is my question: How do i add the ViewController.xib file, and how do I get rid of the storyboard? Do I just delete it?

P.S. I am a beginner in Objective-C (also I don't have much knowledge in programming) and I am just starting out with Xcode so thanks in advance .
Reply With Quote
  #2 (permalink)  
Old November 22nd, 2013, 11:45 AM
Friend of Wrox
Points: 1,671, Level: 16
Points: 1,671, Level: 16 Points: 1,671, Level: 16 Points: 1,671, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2010
Posts: 298
Thanks: 1
Thanked 62 Times in 60 Posts
Default

These are the steps you will need to take.
1. In the Project Navigator (interface column on the left) delete the storyboard and the ViewController.h and .m files. (select Move to trash in the dialogue that comes up when you hit the delete key)
2. In the Main Menu select New>File. In the dialogue that comes up name the file ViewController, and choose subclass of UIViewController. Make sure the "With XIB for user interface" box is checked
3. In the Project Navigator select the uppermost item (has Xcode icon and the project name) In the Main editor you should see an option for "General". Under this there is a disclosure triangle and a section titled Deployment Info. If it is not open, open the disclosure to see your options. Delete the word "Main" from the Main Interface textfield.
4. Select the AppDelegate.h file edit it to read as follows (changes are in bold):
Code:
#import <UIKit/UIKit.h>
@class ViewController;

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) ViewController *viewController;

@end
5. Select the AppDelegate.m file and edit it to read as follows (changes are in bold):
Code:
#import "AppDelegate.h"
#import "ViewController.h"

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
    self.window.rootViewController = self.viewController;
    [self.window makeKeyAndVisible];
    return YES;
}
You can now follow the steps in the book to set up the interface. There are 2 errors in the book on p. 40 that will need to be corrected as well. Steps 18 and 19 need to refer to mySlider as self.mySlider

Code:
- (IBAction)buttonPressed:(id)sender {
    counter++;
    self.myLabel.text = [[NSNumber numberWithInt:counter] stringValue];
    self.mySlider.value = counter;
    
}

- (IBAction)sliderMoved:(id)sender {
    counter = self.mySlider.value;
    self.myLabel.text = [[NSNumber numberWithInt:counter] stringValue];
}
In the downloadable code the author did not initially make the slider outlet a property, so it can be accessed directly. As it is in the book it is a property, so the accessor should be used. The implementation in the book did not reflect this change.

Bob
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
xcode 4? kingfingerjr BOOK: Beginning iOS Game Development 2 August 22nd, 2013 07:58 AM
Chapter 1 and Xcode 4.2 diggerbyte BOOK: Professional iPhone and iPad Database Application Programming 0 March 17th, 2012 10:35 PM
Storyboard normannasty BOOK: Beginning iPhone SDK Programming with Objective-C 1 March 15th, 2012 11:23 PM
Xcode vs Dashcode Rich Mansfield Xcode 2 October 26th, 2011 10:07 AM
xcode for "learning" Molder Intro Programming 0 April 24th, 2008 11:10 PM



All times are GMT -4. The time now is 11:26 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.