首页 > 代码库 > NSObject中的performSelector:withObject用法简介

NSObject中的performSelector:withObject用法简介

- (id)performSelector:(SEL)aSelector withObject:(id)anObject

Description

[说明]

Sends a message to the receiver with an object as the argument. (required)

[将消息发送到接收器与一个对象作为参数。(必填)]

 

This method is the same as performSelector: except that you can supply an argument for aSelector. aSelector should identify a method that takes a single argument of type id. For methods with other argument types and return values, use NSInvocation.

[这种方法是一样的performSelector:除非你能提供的aSelector参数。 aSelector应确定一种方法,它接受一个单一类型的id参数。与其他类型的参数和返回值的方法,使用NSInvocation。]

Parameters

[参数]

aSelector

A selector identifying the message to send. If aSelector is NULL, an NSInvalidArgumentException is raised.

[选择器确定要发送的消息。如果aSelector为NULL,一个NSInvalidArgumentException提高。]

anObject

An object that is the sole argument of the message.

[一个对象,它是消息的唯一理由。]

Returns

[返回]

An object that is the result of the message.

[一个对象,它是消息的唯一理由。]

Availability

[可用于]

OS X (10.0 and later)

Declared In

[宣称]

NSObject.h

Reference

[参考]

NSObject Protocol Reference

NSObject中的performSelector:withObject用法简介