ios - Error :- -[UIButton setValue:]: unrecognized selector sent to instance -
i had created 1)customcell in table , there 1 button , 1 slider within cell.
nsstring *cellidentifier = [nsstring stringwithformat:@"%d",indexpath.row]; if (obj_textcell == nil) { obj_textcell = [[[textcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier] autorelease]; } uibutton* btn_music=[[uibutton alloc] initwithframe:cgrectmake(130,180, 50,50)]; if (indexpath.row==play_tg) { [btn_music setimage:[uiimage imagenamed:@"pausemusic.png"] forstate:uicontrolstatenormal]; }else { [btn_music setimage:[uiimage imagenamed:@"playmusic.png"] forstate:uicontrolstatenormal]; } [btn_music addtarget:self action:@selector(playaudio:) forcontrolevents:uicontroleventtouchupinside]; btn_music.tag = indexpath.row; [obj_textmusiccell.contentview addsubview:btn_music]; [background bringsubviewtofront:btn_music]; uislider *progress = [[uislider alloc] initwithframe:cgrectmake(180,195,320,10)]; [progress setbackgroundcolor:[uicolor clearcolor]]; progress.minimumvalue = 0.0; progress.maximumvalue=1.0; progress.continuous = yes; progress.value = 0.0; progress.tag=indexpath.row+1; nslog(@"tag slider========>%d",progress.tag); //[progress settag:indexpath.row]; [progress addtarget:self action:@selector(sliderchanged:) forcontrolevents:uicontroleventvaluechanged]; [obj_textmusiccell.contentview addsubview:progress];
2)the ibaction event of button had fetch cell.and had called method in slider moves.
-(ibaction)playaudio:(id)sender { uibutton *btn_music=sender; cell_access = (textmusiccell *)[tbl_telltale viewwithtag:0]; nsindexpath *indexpath = [tbl_telltale indexpathforcell:cell_access]; nslog(@"cellindex==>%d",indexpath.row); if ( timer==nil) { timer = [nstimer scheduledtimerwithtimeinterval:1.0 target:self selector:@selector(songprogress) userinfo:nil repeats:yes]; [timer fire]; } }
3)the method in slider has :-
-(ibaction)songprogress { uislider* progress = (uislider *)[cell_access viewwithtag:1]; }
4)it works perfectly.but when scroll table view or @ time application crashed , give below error:-
-[uibutton setvalue:]: unrecognized selector sent instance 0x96f9660 2013-02-20 19:54:21.008 shc[3776:19d03] *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[uibutton setvalue:]: unrecognized selector sent instance 0x96f9660' *** first throw phone call stack: (0x3dba012 0x2777e7e 0x3e454bd 0x3da9bbc 0x3da994e 0x108d1b 0x21c0b90 0x3d79376 0x3d78e06 0x3d60a82 0x3d5ff44 0x3d5fe1b 0x33de7e3 0x33de668 0x16bf65c 0x2cb6 0x2be5 0x1) libc++abi.dylib: terminate called throwing exception
-[uibutton setvalue:]: unrecognized selector sent instance
please help me
you using same tag value uibutton* btn_music uislider *progress, hence uislider *progress getting uibutton instance utilize different tag values both if using 1 200 tag value uibutton utilize 201 plus values uislider *progress
ios uitableview uibutton
No comments:
Post a Comment