If you just want your code to work, upgrade and accept Paul.s.'s answer. If you want to read about nerds doing experiments, go ahead. In the comments on my initial answer, there were some interesting discussions that I summarized below.
This does not work. I tried this in an iOS project, the userInteractionEnabled property is not affected by sending performSelector:withObject: This is consistent with the documentation for NSObject, which states:
aSelector must identify a method that takes a single argument of a type identifier. For methods with other argument types and return values, use NSInvocation.
Currently, the legendary Peter Hosey has built a sample creation tool here that looks bizzarely working enough when you pass it a double as well as a float, as I recognized myself.
To add curiosity to curiosity, this does not work in an iOS project (double or float).
In general, I think we can say the following:
- If it ever works, it works randomly and should not rely on
- An accepted or confirmed response to a stack overflow is not always correct.
source share