Re: Beginner Question Re: Memory Management

2009-06-23 Thread Peter N Lewis
On 23/06/2009, at 12:31 , WT wrote: So, after I scratched my head silly for several minutes, it suddenly came to me. If I'm going to use a property, I *must* refer to it as object.property rather than simply as property. In the specific example I had, I should not have replaced all those rep

Re: Beginner Question Re: Memory Management

2009-06-23 Thread Michael Ash
On Tue, Jun 23, 2009 at 2:05 AM, WT wrote: > On Jun 23, 2009, at 7:37 AM, Eric Hermanson wrote: > >> UNFORTUNATELY, the iPhone Simulator does not support instance variable >> synthesis (at least it didn't in 2.x, maybe that changed in 3.0). > > I just tested that in the 3.0 simulator and it does NO

Re: Beginner Question Re: Memory Management

2009-06-23 Thread Michael Ash
On Tue, Jun 23, 2009 at 12:31 AM, WT wrote: > What the heck??? > > So, after I scratched my head silly for several minutes, it suddenly came to > me. If I'm going to use a property, I *must* refer to it as object.property > rather than simply as property. In the specific example I had, I should not

Re: Beginner Question Re: Memory Management

2009-06-23 Thread Mike Abdullah
Note also that you should really be using -copy for string properties. It has the same effect as -retain, but also handles the possibility of someone handing in an NSMutableString. On 23 Jun 2009, at 06:15, Graham Cox wrote: On 23/06/2009, at 2:31 PM, WT wrote: [textFieldPreviousContent

Re: Beginner Question Re: Memory Management

2009-06-22 Thread WT
On Jun 23, 2009, at 7:37 AM, Eric Hermanson wrote: UNFORTUNATELY, the iPhone Simulator does not support instance variable synthesis (at least it didn't in 2.x, maybe that changed in 3.0). I just tested that in the 3.0 simulator and it does NOT support ivar synthesis. Wagner ___

Re: Beginner Question Re: Memory Management

2009-06-22 Thread WT
On Jun 23, 2009, at 7:29 AM, Quincey Morris wrote: On Jun 22, 2009, at 21:31, WT wrote: So, to all beginners out there, whenever you define a property, remember always to refer to it, in its own class, by self.property - at least when setting its value. It may be ok (depending on what you

Re: Beginner Question Re: Memory Management

2009-06-22 Thread Eric Hermanson
Objective-C 2.0 supports not only property getter/setter synthesis, but instance variable synthesis. This means that you do not even have to declare the instance variable. As long as the property is defined correctly, the instance variable (and the getter/setter) will be created for you

Re: Beginner Question Re: Memory Management

2009-06-22 Thread Quincey Morris
On Jun 22, 2009, at 21:31, WT wrote: So, to all beginners out there, whenever you define a property, remember always to refer to it, in its own class, by self.property - at least when setting its value. It may be ok (depending on what you're doing) to refer to it simply by property when *ge

Re: Beginner Question Re: Memory Management

2009-06-22 Thread WT
On Jun 23, 2009, at 7:15 AM, Graham Cox wrote: On 23/06/2009, at 2:31 PM, WT wrote: [textFieldPreviousContent release]; textFieldPreviousContent = [textField.text retain]; This is not a safe pattern anyway (though it's not the same as the discussion you raised). In isolation, suppose that

Re: Beginner Question Re: Memory Management

2009-06-22 Thread Graham Cox
On 23/06/2009, at 2:31 PM, WT wrote: [textFieldPreviousContent release]; textFieldPreviousContent = [textField.text retain]; This is not a safe pattern anyway (though it's not the same as the discussion you raised). In isolation, suppose that the previous text and the current text are th

Re: Beginner Question Re: Memory Management

2009-06-22 Thread Ken Thomases
On Jun 22, 2009, at 3:39 PM, Daniel Torrey wrote: I'm looking at some sample iPhone code, and in the app delegate's applicationDidFinishLaunching method, I see // Set up the view controller MyViewController *aViewController = [[MyViewController alloc] initWithNibName:@"HelloWorld"

Re: Beginner Question Re: Memory Management

2009-06-22 Thread Henry McGilton (Boulevardier)
On Jun 22, 2009, at 1:39 PM, Daniel Torrey wrote: I'm looking at some sample iPhone code, and in the app delegate's applicationDidFinishLaunching method, I see // Set up the view controller MyViewController *aViewController = [[MyViewController alloc] initWithNibName:@"HelloWorld"

Re: Beginner Question Re: Memory Management

2009-06-22 Thread WT
On Jun 23, 2009, at 4:47 AM, Graham Cox wrote: On 23/06/2009, at 6:39 AM, Daniel Torrey wrote: I'm looking at some sample iPhone code, and in the app delegate's applicationDidFinishLaunching method, I see // Set up the view controller MyViewController *aViewController = [[MyViewCon

Re: Beginner Question Re: Memory Management

2009-06-22 Thread Graham Cox
On 23/06/2009, at 6:39 AM, Daniel Torrey wrote: I'm looking at some sample iPhone code, and in the app delegate's applicationDidFinishLaunching method, I see // Set up the view controller MyViewController *aViewController = [[MyViewController alloc] initWithNibName:@"HelloWorld" b

Beginner Question Re: Memory Management

2009-06-22 Thread Daniel Torrey
Hi, I'm looking at some sample iPhone code, and in the app delegate's applicationDidFinishLaunching method, I see // Set up the view controller MyViewController *aViewController = [[MyViewController alloc] initWithNibName:@"HelloWorld" bundle:[NSBundle mainBundle]]; self.m