When to use a colon with a @selector

前端 未结 6 1226
傲寒
傲寒 2020-12-03 04:10

Just getting going with iPhone development and Objective-C.

Yesterday I was trying to addObserver for a notification in a view of mine, and I kept getti

6条回答
  •  执笔经年
    2020-12-03 04:23

    The colon indicates that the method takes a parameter.

    [someObject performSelector:@selector(doSomething:)] means that doSomething is expecting a parameter.

    [someObject performSelector:@selector(doSomething)] means that doSomething doesn't need any parameters.

提交回复
热议问题