-1

Possible Duplicate:
What does @synthesize window=_window do?

How come when you @synthesize something like buttonPressed , You need to do this:

@synthesize buttonPressed = buttonPressed_; 

I've been following some tutorials and this keeps coming up. Why?

Community
  • 1
  • 1
Matt Bettinson
  • 533
  • 3
  • 8
  • 22

1 Answers1

3

You do not have to do it that way.

By default, @synthesize variableName does work, if your synthesized accessors shall have the same name as your instance variable.

In your example, the instance variable is called buttonPressed_ but your accessor methods will omit the _ and thus just be called setButtonPressed and buttonPressed.

tobiasbayer
  • 10,269
  • 4
  • 46
  • 64