Tagged Questions
2
votes
4answers
969 views
When to use instance variables and when to use properties
When using Objective-C properties can you stop creating instance variables altogether or do explicit instance variables (not the ones synthesized by the properties) still serve a purpose where ...
0
votes
1answer
108 views
ivar will not respond to NSMutableString method
#import <Foundation/Foundation.h>
@interface Engine : NSObject {
NSMutableString *mutableName;
}
@property (assign) NSMutableString *mutableName;
@end
Why does my ivar, engine.name not ...
1
vote
2answers
291 views
NSMutableArray as an Instance Variable
I have a instance variable which is a NSMutableArray
@interface SummaryWindowController : NSWindowController {
NSMutableArray *aBuffer;
The NSMutableArray is set using this method (called from ...
2
votes
2answers
684 views
public objects and use of property
I'm a bit confused; if an object is declared in the .h file it is considered automatically as "public" right? We use a @property in the .h file, however, to edit them? This is where I don't ...
0
votes
1answer
599 views
Best way of declaring private variables in cocoa
I would like to know what the recommendations are for declaring private instance variables in cocoa. This question is in the context of developing apps on the iPhone.
I am aware of at least three ...
3
votes
3answers
465 views
Objective-C 2.0: Inheriting synthesised instance variables
I have the following code:
// ClassA.h
@interface ClassA : NSObject
@property (nonatomic, retain, readonly) id my_property;
@end
// ClassA.m
@implementation ClassA
@synthesize my_property;
- ...
1
vote
1answer
215 views
creating instance-variables at runtime?
hey i've got a little confusion here..
I'm using the EyeTunes Framework for a little learning project. It's an iTunes Controller.
The framework gave me an array of playlists currently existing in ...
0
votes
4answers
562 views
How to use c array as instance variable in an object in Objective-C?
I want to declare a c array as an instance variable (e.g. int arr[256]) in the interface block of a Cocoa object. I know that @property doesn't support c arrays but how to manually add the getter and ...
7
votes
3answers
624 views
Best practice for copying private instance vars with NSCopying
I might be missing something obvious here, but I'm implementing NSCopying on one of my objects. That object has private instance variables that are not exposed via getters, as they shouldn't be used ...
0
votes
2answers
254 views
Property Refuses to Synthesize
I've been going through the screencasts here to learn how to write a table-based iPhone application, and it's been going pretty smoothly so far. Presently I'm halfway through the third episode, and ...
36
votes
5answers
12k views
Properties and Instance Variables in Objective-C
I'm rather confused about properties and instance variables in Objective-C.
I'm about half-way through Aaron Hillegass's "Cocoa Programming for Mac OS X" and everything is logical. You would declare ...