Creating a function and calling it from a UIButton connected to an IBAction?
I have an iPhone app called i4MMS it is published in Cydia. I'm really a noob with this but I wanted to find a way to create a function or method and then call it using IBAction. Would it be like this?
+ (void) myMethod {
NSLog(@"Step 1");
NSLog(@"Step 2");
}
[myBu开发者_JAVA技巧tton addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
- (IBAction)buttonClicked:(id)sender{
myMethod
}
change
myMethod
in your IBAction method
to
[<insert name of class here> myMethod]
;
精彩评论