I am a mere beginner in iPhone Programming. I have seen this code in a tutorial which I didn't understand what does it means. I am confused about keywords such as titleForState
and initWithFormat
.
Can anyone help me to understand the meaning and importance of this syntax.
-(IBAction)buttonPressed: (id)sender {
NSString *title = [sender **titleForState**:UIControlStateNormal];
NSString *newText = [[NSString alloc] **initWithFormat**:
@"%@ button pressed.", title];
statusText.text = newText;//statustext is a label
[newText release];
}