user3208025
user3208025

Reputation: 21

objective-c method name in a protocol UIActionSheetDelegate

I'm looking at a method

  -(void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex

in the interface UIActionSheetDelegate. Is actionSheet a parameter name or part of method name???

Is the following a matching C declaration?

  (void) actionSheetdidDismissWithButtonIndex(UIActionSheet *actionSheet, NSInteger buttonIndex);

Upvotes: 1

Views: 38

Answers (2)

Prince Agrawal
Prince Agrawal

Reputation: 3607

In the method actionSheet:didDismissWithButtonIndex: , there are 2 parameters. actionSheet & buttonIndex. A view controller might be delegate of multiple actionSheets, so first parameter tells about the actionSheet which triggered the method. Similarly, an actionSheet May contain multiple buttons, so 2nd parameter tells you, which button was pressed.

For this method:

 -(void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex

This is the C equivalent:

(void) actionSheetdidDismissWithButtonIndex(UIActionSheet *actionSheet, NSInteger buttonIndex);

Upvotes: 0

Aaron Brager
Aaron Brager

Reputation: 66292

Is actionSheet a parameter name or part of method name???

Both. The full method name is actionSheet:didDismissWithButtonIndex:, so "actionSheet" is part of that. The parameters are actionSheet and buttonIndex.

Is the following a matching C declaration?

Yes.

Upvotes: 2

Related Questions