Re: makeObjectsPerformSelector on a sub class
Re: makeObjectsPerformSelector on a sub class
- Subject: Re: makeObjectsPerformSelector on a sub class
- From: Quincey Morris <email@hidden>
- Date: Wed, 21 Mar 2012 13:23:22 -0700
On Mar 21, 2012, at 07:56 , Pascal Harris wrote:
> @interface gameTile : UIView
>
> And I've successfully drawn my tiles onto the iOS Simulator screen.
>
> Now I want to scramble the state of each of the tiles. In the game controller, I'm using the following code:
>
> [[self.view subviews] makeObjectsPerformSelector:@selector(scrambleState)];
>
> I've put a breakpoint in scrambleState - and it never gets called. I'm guessing that 'makeObjectsPerformSelector' fails to work because scrambleState is not a method in UIView. Question is, what do I need to do in order to ensure that this code gets called?
Assuming that 'scrambleState' is a method of the 'gameTile' class, then it doesn't matter that it's not a UIView method -- it only matters that it's a method of the objects you send the selector to, i.e. the subviews.
One thing to check: if your 'scrambleState' actually has a parameter:
- (void) scrambleState: …
Then you need '@selector(scrambleState:)', not '@selector(scrambleState)'. It's an easy thing to overlook.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden