|
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Junior Member
Join Date: Jul 2009
Posts: 4
|
Hi there,
I am fairly new to iPhone development and Objective-C. Having one of those late nights where you just cant work out a solution to a problem and wondered if anyone could help? I have developed an app with 2 buttons. Within the method for one of the buttons I have assigned a value to a variable (NSDate dteInception). I am keen to use this variable (and the assigned value) within the method for the second button. Can anyone provide tips/advice/solution on how this can be done? Cheers, Charlie |
|
|
|
|
|
#2 (permalink) |
|
Administrator
Join Date: Mar 2008
Location: San Diego, CA
Posts: 508
|
Hi Charlie,
Yeah, you need to get a fundamental understanding of instance variables and how you access their values. When you understand them, then you realize you can ask your "self" for the value of one of your variables, or ask any other object (including the application object) for the value of it's instance variable. This is an important concept to understand before proceeding, and has to do the the model-view-controller separation of values (model), the user interface (view) and the application logic (controller). Look in the Apple documentation and the must-have book Beginning iPhone Development for the following terms model-view-controllerIt's easier to understand than you think. Also, don't forget to watch the introductory videos from both Apple and the Stanford iPhone development videos for easy-to-understand explanations that start talking about Objective-C. In fact, I'd do that first. Evan Doll of Stanford does a great job of explaining things in the third video of the set. If you already know a bunch of this stuff, I apologize. But rather than give specific answers, I believe it's more important to have a solid understanding of how things work instead. But that's me. Mark |
|
|
|
|
|
#4 (permalink) | |
|
Junior Member
Join Date: Jul 2009
Posts: 4
|
Mark (or anyone else?),
While I am downloading all the beginner videos, could anyone suggest what code I could write to resolve this issue: In the .m file, I have 2 buttons and create an instance variable within one of the methods. How can I then use that instance variable within the second method? Quote:
Mark - I am following your training guide, but is it possible you could provide any pointers on this exact example (I have looked into "self" and am not sure if this is correct or if I should be using @public)? Cheers, Charlie |
|
|
|
|
![]() |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd. Search Engine Friendly URLs by vBSEO 3.3.0 RC1 |




Linear Mode
