performSelector with more than 2 objects

前端 未结 3 1507
旧时难觅i
旧时难觅i 2020-12-23 16:45

Is there a way to call [anObject performSelector]; with more than 2 objects? I know you can use an array to pass multiple arguments, but I was wondering if there was a lowe

3条回答
  •  青春惊慌失措
    2020-12-23 16:49

    Either (1) Use an NSInvocation or (2) directly use objc_msgSend.

    objc_msgSend(target, @selector(action:::), arg1, arg2, arg3);
    

    (Note: make sure all arguments are id's, otherwise the arguments might not be sent correctly.)

提交回复
热议问题