This is largely a syntax issue. How to set a UIButton action selector to call a method of another class? I made a #import class, the methods of which I need to call using the button, and I have the following partial understanding of how the button code should look:
UIButton *btnSplash = [UIButton buttonWithType:UIButtonTypeRoundedRect]; btnSplash.frame = CGRectMake(250, 270, 180, 30); [btnSplash setTitle:@"Menu" forState:UIControlStateNormal]; [btnSplash addTarget:self action:@selector([CLASS METHOD:PARAMETER]) forControlEvents:UIControlEventTouchUpInside]; [self addSubview:btnSplash];
However, I get the following errors:
expected ':' before '[' token
method name is missing in @selector
The sample code that I saw in the help library calls local methods, so I'm trying to generalize, and my attempts have so far been fruitless.
thanks
source share