
这是我在索引方法行的单元格
static Nsstring *CellIDentifIEr = @"Cell4";UItableVIEwCell *cell = [tableVIEw dequeueReusableCellWithIDentifIEr:CellIDentifIEr];if (cell == nil){ cell = [self tablevIEwCellWithReuseIDentifIErFollowing:CellIDentifIEr];}followingbutton = [UIbutton buttonWithType:UIbuttonTypeCustom];[followingbutton addTarget:self action:@selector(followingbuttonpressed:)forControlEvents:UIControlEventtouchUpInsIDe];[followingbutton setimage:[UIImage imagenamed:@"following12.png"] forState:UIControlStatenormal];followingbutton.frame = CGRectMake(220.0,20.0,100,40.0);[cell.contentVIEw addSubvIEw:followingbutton];NSLog(@"row--%d",indexPath.row);followingbutton.tag=indexPath.row;NSLog(@"followingbutton.tag--%d",followingbutton.tag);[self configureCellFollowing:cell forIndexPath:indexPath];return cell;}==================//Here is the action method-(voID)followingbuttonpressed:(ID)sender{ NSLog(@"sender tag --%d",[sender tag]); UIbutton *btnPly = (UIbutton *)sender; if([btnPly isSelected]) { [btnPly setSelected:NO]; [btnPly setimage:[UIImage imagenamed:@"following12.png"] forState:UIControlStatenormal]; } else { [btnPly setSelected:YES]; [btnPly setimage:[UIImage imagenamed:@"following_off12.png"] forState:UIControlStatenormal]; }}解决方法 注意:此代码为每行数据创建单元格(不重用单元格) 您只需按描述进行更改,可能对您有所帮助
Nsstring *CellIDentifIEr = [Nsstring stringWithFormat:@"S%1dR%1d",indexPath.section,indexPath.row];UItableVIEwCell *cell = [tableVIEw dequeueReusableCellWithIDentifIEr:CellIDentifIEr];
可能会解决你的问题:)
总结以上是内存溢出为你收集整理的iphone – UITableview的滚动改变了UIButton,UITableview滚动问题的图像全部内容,希望文章能够帮你解决iphone – UITableview的滚动改变了UIButton,UITableview滚动问题的图像所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)