to call a function in other one
Hi I have following function in a file i want to call it inside another method of same class the second
(void)touchesBegan:开发者_Go百科(NSSet *)touches withEvent:(UIEvent *)event { // Issue vibrate AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
// Also issue visual alert UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Screen Touched!" message:nil delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK", nil]; [alert show]; }
i want to call it inside another method of same class the second function is called with the button press the second method is
-(IBAction)resetBet:(id)sender { //call function here.... //some code...... } Basically what i am tring to do is to make device vibrate when button click please tell me how to call the function.
[self resetBet:nil];
should call the resetBet method.. or you can use an object like a button instead of the "nil". Hope that's what you meant..
Do what stackr said :D or use a selector.
精彩评论