I was wondering: what's the difference between writing a selector name with no colon @selector(mySelector)
, or @selector(mySelector:)
with the colon?
As in:
UIBarButtonItem *addButton = [[UIBarButtonItem alloc]initWith...
target:self
action:@selector(addAction:)];
I can't find another example without the colon, but I'm quite sure I have already seen some of them.
A CSS pseudo-element is a keyword added to a CSS selector that lets you style a specific part of the selected HTML element. In CSS3, they are usually denoted by two colons — for example, ::first-line — to differentiate them from pseudo-classes. In contrast, CSS2 syntax uses one colon (e.g., :first-line ).
Technically, the correct answer is ::before .
jQuery can use some of these to perform selections as well. One of these is :even which selects every other matched element starting with the second. Basically, it's being used here as a shortcut for selecting half of the pieces.
It means pseudo element selector. It means the element to the right doesn't exist in the normal DOM, but can be selected.
The colon is needed after the method's name if and only if the method takes an argument.
No function parameters:
-(void)addAction {}
// Use ...@selector(addAction)...
Has parameter:
-(void)addAction:(id)info {}
// Use ...@selector(addAction:)...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With