开发者

Creating a function and calling it from a UIButton connected to an IBAction?

开发者 https://www.devze.com 2023-03-17 18:48 出处:网络
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 thi

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];

0

精彩评论

暂无评论...
验证码 换一张
取 消