Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 9th, 2012, 10:39 PM
Authorized User
 
Join Date: Mar 2012
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 2 exercise question

So for exercise 2 exercise question #5

Loking at the answer, I notice this line that I didn't implement but worked anyway

"@interface ExerciseViewController: UIViewController { UILabel *textLabel;}


Mine is left alone and looks like this:
"@interface ExerciseViewController: UIViewController"
And the remainder of the code is identical. Is there any benefit creating this instance here? Thanks!
 
Old March 9th, 2012, 10:41 PM
Authorized User
 
Join Date: Mar 2012
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default

PS Awesome book! I read 3 books prior. First book was too easy, second book (about objective C) had WAY too many typos to the point it's garbage. Third book about SDK was awesome to familiarize myself with SDK, but doesn't teach programming.

This is the fourth book, and it seems 4th is the charm! I like how entry level this book is. I should've gotten this book first!
 
Old March 10th, 2012, 08:53 AM
Friend of Wrox
 
Join Date: Aug 2010
Posts: 298
Thanks: 1
Thanked 62 Times in 60 Posts
Default

Variables no longer need to be declared independently of @properties. So,


Code:
@interface ExerciseViewController : UIViewController

@property (strong, nonatomic) IBOutlet UILabel *textLabel;

@end
and

Code:
@interface ExerciseViewController : UIViewController
{
    UILabel *textLabel;
}

@property (strong, nonatomic) IBOutlet UILabel *textLabel;

@end
both work. In fact the first one is more consistent with the approach Apple now uses. The second can now be considered a bit redundant.

Bob
 
Old March 10th, 2012, 02:46 PM
Authorized User
 
Join Date: Mar 2012
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ah thanks!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 6 Exercise 4 narukami BOOK: Beginning Visual C# 2010 2 December 30th, 2011 04:02 PM
Chapter 2 Exercise 2 rolndd BOOK: Ivor Horton's Beginning Visual C++ 2010 2 July 12th, 2011 01:58 PM
Chapter 8 exercise 3 Will BOOK: Beginning C# 3.0 : An Introduction to Object Oriented Programming ISBN: 978-0-470-26129-3 8 March 4th, 2010 04:15 AM
Chapter 8 exercise 1 Will BOOK: Beginning C# 3.0 : An Introduction to Object Oriented Programming ISBN: 978-0-470-26129-3 2 March 2nd, 2010 03:26 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.