I'm trying to get a UI Button to interact with a UI Label through Xcode and Interface Builder. What should I change in this code to do so? (I have everything linked up in Interface Builder already. The app just crashes when I press the button.)
@synthesize window;
@synthesize label;
@synthesize anotherLabel;
@synthesize myButton;
#pragma mark -
#pragma mark Application lifecycle
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[myButton setTitle:@"Press Here" forState:UIControlStateNormal];
window.backgroundColor = [UIColor grayColor];
label.text = [[NSDate date] description];
// Override point for customization after application launch.
[myButton addTarget:anotherLabel action:@selector(doButton:) forControlEvents:UIControlEventTouchUpInside];
[window makeKeyAndVisible];
return YES;
}
-(void) doButton:(UILabel *)anotherLabel{
static int count;
count++;
}