Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
可能重复: 目标 C:什么是“(id)发件人”?
什么是(id)发件人:
-(IBAction)action:(id)sender;
谢谢你的帮助!
它是任何对象调用了动作方法;例如,一个按钮。
例如,您可以使用 id 来检查一组按钮中的哪一个称为操作。
它标识(并引用)发送操作消息的控制对象。
从目标动作设计模式:
sender 参数是发送动作消息的控制对象。在响应动作消息时,您可以查询发件人以获取有关触发动作消息的事件的上下文的更多信息。