Reputation: 175
The following line compiles fine but incorrectly returns false in iOS 8. Why?
[[NSLayoutConstraint class] respondsToSelector:@selector(setActive:)]
However, the following correctly returns true -
[self.heightLayoutConstraint respondsToSelector:@selector(setActive:)]
where self.heightLayoutConstraint
is of type NSLayoutConstraint
.
Upvotes: 0
Views: 552
Reputation: 64002
setActive:
is not a class method on NSLayoutConstraint
, so the return value is correct: the class itself does not respond to that selector.
I think you're looking for the class method +instancesRespondToSelector:
[NSLayoutConstraint instancesRespondToSelector:@selector(setActive:)]
Upvotes: 2