Ilya Suzdalnitski
Ilya Suzdalnitski

Reputation: 53540

How can I pass arguments with UIActionSheet?

I have an Action Sheet popping up and I want to pass a certain argument to a button processing method.

For example:

I have a table and I want to pass to a button processing method row number that was selected in a table.

How can I achieve this?

Upvotes: 8

Views: 2936

Answers (3)

LetBulletFlies
LetBulletFlies

Reputation: 285

if you want to pass an integer, use UIActionSheet.tag. if you want to pass a NSString, use UIActionSheet.accessibilityValue.

these are simple and easy. no need to create an instance variable.

Upvotes: 3

user102008
user102008

Reputation: 31303

If it is an integer argument, put it as the tag property of the action sheet. Otherwise, you can subclass the action sheet and put variables there, or use associative references.

Upvotes: 3

Andrew Grant
Andrew Grant

Reputation: 58786

You would have to set this in your delegate ahead of time. You can then use this value when your delegate receives the button press notification.

Upvotes: 6

Related Questions