synthesize

@synthesize statusText;

This is how we tell the compiler to automatically create the accessor and mutator methods for us.

two invisible methods in out class

:statusText   setStatusText:   

but they are there  nonetheless  waiting for use them.

when either button is tapped

-(IBAction)buttonPressed: (id)sender {

  NSString *title = [sender titleForState:UIControlStateNormal];

  NSString *newText = [[NSString alloc] initWithFormat:

              @"%@ button pressed.", title];

}

posted @ 2012-09-07 08:37  顺武  阅读(243)  评论(0编辑  收藏  举报