All Questions

559
votes
20answers
246876 views

@selector() in Swift?

I'm trying to create an NSTimer in Swift but I'm having some trouble. NSTimer(timeInterval: 1, target: self, selector: test(), userInfo: nil, repeats: true) test() is a function in the same class. ...
73
votes
6answers
132696 views

android button selector

This is a button selector such that when normal it appears red, when pressed it appears grey. I would like to ask how could the code be further directly modified such that when PRESSED the text size ...
52
votes
1answers
16247 views

How do I resolve "ambiguous use of" compile error with Swift #selector syntax?

Let's say I have these two methods in my class: func test() {} func test(sender:AnyObject?) {} Now I want to use Swift 2.2's new #selector syntax to make a selector corresponding to the first of th...
63
votes
7answers
104263 views

Trying to handle "back" navigation button action in iOS

I need to detect when the user taps the "back" button on the navigation bar, in order to perform some operations when that occurs. I'm trying to set manually an action to such button, this way: [self...
134
votes
7answers
194387 views

Objective-C: Calling selectors with multiple arguments

In MyClass.m, I've defined - (void) myTest: (NSString *) withAString{ NSLog(@"hi, %@", withAString); } and the appropriate declaration in MyClass.h . Later I want to call [self performSelector...
86
votes
8answers
87290 views

iOS - How to implement a performSelector with multiple arguments and with afterDelay?

I am an iOS newbie. I have a selector method as follows - - (void) fooFirstInput:(NSString*) first secondInput:(NSString*) second { } I am trying to implement something like this - [self perfor...
46
votes
11answers
103645 views

Passing parameters on button action:@selector

I want to pass the movie url from my dynamically generated button to MediaPlayer: [button addTarget:self action:@selector(buttonPressed:) withObject:[speakers_mp4 objectAtIndex:[indexPath row]] forCo...
35
votes
5answers
12973 views

List selectors for Objective-C object

I have an object, and I want to list all the selectors to which it responds. It feels like this should be perfectly possible, but I'm having trouble finding the APIs.
27
votes
5answers
37938 views

SEL performSelector and arguments

It seems like there should be an easy way to call a selector with some arguments when all you have is a SEL object. I can't seem to find the correct syntax. -(MyClass*) init: (SEL)sel owner:(NSObject...
52
votes
3answers
115246 views

Creating a selector from a method name with parameters

I have a code sample that gets a SEL from the current object, SEL callback = @selector(mymethod:parameter2); And I have a method like -(void)mymethod:(id)v1 parameter2;(NSString*)v2 { } Now I...

Previous Next