Making custom UIView with two UIButtons for UITableViewCell accessoryView member causes unrecognized selector sent to instance error?

Realized my own stupid mistake: Was trying to call on subtractOne:event: when I wrote method for subtractOne:forEvent.

Up vote 1 down vote favorite share g+ share fb share tw.

I'm trying to make a view with two buttons for a table cell accessory view to do two (obviously) different things to the object at that cell index. I made two basic rounded rect UIButtons with a selector in the RootViewController (where the UITableView resides). Here is the code I use to initialize this view in a cell that is found in the cellForRowAtIndexPath method: UIButton* minus = UIButton buttonWithType:UIButtonTypeRoundedRect retain; minus setFrame:CGRectMake(0, 0, 30, 30); minus setTitle:@"-" forState:UIControlStateNormal; minus addTarget:self action:@selector(subtractOne:event:) forControlEvents:UIControlEventTouchDown; UIButton* plus = UIButton buttonWithType:UIButtonTypeRoundedRect retain; plus setFrame:CGRectMake(30, 0, 30, 30); plus setTitle:@"+" forState:UIControlStateNormal; plus addTarget:self action:@selector(addOne:event:) forControlEvents:UIControlEventTouchDown; UIView* customAccessory = UIView alloc initWithFrame:CGRectMake(0, 0, 60, 30); customAccessory addSubview:minus; customAccessory addSubview:plus; cell.

AccessoryView = customAccessory; customAccessory release; And the two methods they call are defined: - (void)subtractOne:(id)sender forEvent:(UIEvent *)event; - (void)addOne:(id)sender forEvent:(UIEvent *)event; Any ideas why this would throw unrecognized sender sent to instance "RootViewController"? Here is the full error: 2011-03-20 20:34:35.493 MyApp23262:207 -RootViewController subtractOne:event:: unrecognized selector sent to instance 0x573c350 2011-03-20 20:34:35.496 MyApp23262:207 * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-RootViewController subtractOne:event:: unrecognized selector sent to instance 0x573c350' uitableview uibutton unrecognized-selector accessoryview link|improve this question asked Mar 21 '11 at 3:36Kristian K1614.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions