Objective C: what is a “(id) sender”?

后端 未结 6 2051
甜味超标
甜味超标 2020-11-29 05:40

In some IBAction I saw:

- (IBAction)pushButton:(id)sender;

This (id)sender when do I use it?

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-29 06:35

    Here's an example of (id)sender passing tag information from several buttons to one IBAction. This video demonstrates the concept of (id) sender in action, which I found to be very useful.

    iPhone Programming - (id)sender explained

提交回复
热议问题