我创造 1)customcell和有1个按钮,滑块1在细胞内。错误: - - [的UIButton的setValue:]:无法识别选择在表发送到实例
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 for slider========>%d",progress.tag);
//[progress setTag:indexPath.row];
[progress addTarget:self action:@selector(sliderChanged:) forControlEvents:UIControlEventValueChanged];
[obj_TextMusicCell.contentView addSubview:progress];
2)按钮i具有取cell.and的IBAction为事件已经调用的方法,其中所述滑块移动。
-(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)在滑块的方法有: -
-(IBAction)SongProgress
{
UISlider* progress = (UISlider *)[cell_Access viewWithTag:1];
}
4)它的工作原理perfectly.But当我滚动表视图或在一段时间内的应用程序来坠毁,给下面的错误: -
-[UIButton setValue:]: unrecognized selector sent to instance 0x96f9660
2013-02-20 19:54:21.008 shc[3776:19d03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIButton setValue:]: unrecognized selector sent to instance 0x96f9660'
*** First throw 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 an exception
- [的UIButton的setValue:]:无法识别的选择发送到实例
请帮我
都喜欢我的UIButton * Btn_music = [[的UIButton的alloc] initWithFrame:方法CGRectMake(130180,50,50)];和用于滑块: - UISlider *进展= [[UISlider的alloc] initWithFrame:方法CGRectMake(180,195,320,10)]; 是不够的?请指导me..Thanks的答案。 – 2013-02-21 03:57:04
现在宣布Btn_music在.h文件中这将如何帮助我解决issue.how,没关系吧,我宣布在.h文件中或.m文件按钮检查它... – apascual 2013-02-21 08:39:16
apascua感谢Reply.But – 2013-02-21 10:11:27