Advertise Books Events Forum News Social Networking Support Us

sdkIQ for iPhone
($4.99)

Shape Up
($0.99)

Your First iPhone App
($1.99)

iVidCam Free
(free)

Kid Art
($0.99)

iPUBQUIZ
(£1.19)

ArtStudio
($3.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 04-11-2009, 08:46 PM   #1 (permalink)
New Member
 
Join Date: Apr 2009
Posts: 5
Default Dot Syntax

Fairly newbish question that has been plaguing me for some time now.

I have a class called "Board"
Here is the Interface:
Code:
@interface Board : NSObject 
{
	int width;
	int height;
	int numCells;
	
	SpawnPoint *spawnPoint;
	Cell *endPoint;
	
	NSMutableArray *cells;
}
I have another class "PathNodeManager"
Code:
@interface PathNodeManager : NSObject 
{
	@private
	NSMutableArray *pathNodes;
	Board *gameBoard;
}

@implementation PathNodeManager
- (id)initWithGameBoard: (Board *) newGameBoard
{
	self = [super init];
	
	if( self !=nil )
	{
		self.gameBoard = newGameBoard;
		
		for( int i=0; i<self.gameBoard.numCells; i++)
			[self.pathNodes addObject:nil];
	}
	
	return self;
}
Now here is the question. When I use self.gameBoard I cannot use auto completion. However, if i just type "gameBoard" auto completion works fine. It seems that dot syntax does not like the "self." in front of it. My understanding is that you should always refer to member variables with a "self.". Should I just give up on dot syntax all together?

Thanks,
Jacob
jacobhb is offline   Reply With Quote
Old 04-11-2009, 08:57 PM   #2 (permalink)
Former NeXTStep Developer
 
Join Date: Mar 2009
Posts: 997
Default

Is it just the editor autocompletion that's bothering you, or is the code actually working differently?

The dot syntax you're using is normally used to invoke the compiler generated setter/getter methods that are created when you use @property/@synthesize. Since you don't have those, the editor is probably somewhat confused. Looks like the compiler doesn't care (unless you're getting errors you haven't mentioned).

joe
FlyingDiver is offline   Reply With Quote
Old 04-11-2009, 09:02 PM   #3 (permalink)
New Member
 
Join Date: Apr 2009
Posts: 5
Default

Sorry, I left out the @property/@synthesize from the code I linked. I have a
@property (retain) Board *gameBoard;
and
@synthesize gameBoard;

Yeah the only issue is xcode not auto competing. Everything compiles and runs fine. I just find it weird that xcode would not auto complete if I add self. onto one of my member variables.



Quote:
Originally Posted by FlyingDiver View Post
Is it just the editor autocompletion that's bothering you, or is the code actually working differently?

The dot syntax you're using is normally used to invoke the compiler generated setter/getter methods that are created when you use @property/@synthesize. Since you don't have those, the editor is probably somewhat confused. Looks like the compiler doesn't care (unless you're getting errors you haven't mentioned).

joe
jacobhb is offline   Reply With Quote
Old 04-11-2009, 09:12 PM   #4 (permalink)
Former NeXTStep Developer
 
Join Date: Mar 2009
Posts: 997
Default

Quote:
Originally Posted by jacobhb View Post
Sorry, I left out the @property/@synthesize from the code I linked. I have a
@property (retain) Board *gameBoard;
and
@synthesize gameBoard;

Yeah the only issue is xcode not auto competing. Everything compiles and runs fine. I just find it weird that xcode would not auto complete if I add self. onto one of my member variables.
Auto-completion is flaky, IMHO.

joe
FlyingDiver is offline   Reply With Quote
Old 04-12-2009, 02:19 AM   #5 (permalink)
New Member
 
Join Date: Apr 2009
Posts: 5
Default

Quote:
Originally Posted by FlyingDiver View Post
Auto-completion is flaky, IMHO.

joe
Thanks for the reply, I just wanted to make sure I was not doing something wrong.
jacobhb is offline   Reply With Quote
Reply

Bookmarks

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Enter the iPhone App Challenge!  Win $500!
» Advertisements
» Stats
Members: 23,994
Threads: 38,776
Posts: 170,152
Top Poster: smasher (2,560)
Welcome to our newest member, wionj
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 09:55 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0