ios7 – SWTableViewCell一次显示一个菜单

ios7 – SWTableViewCell一次显示一个菜单,第1张

概述我正在使用SWTableViewCell在tableView中显示我的friendsList.根据代码一切正常.问题是,我一次只需要一个活动单元.现在我可以通过一个接一个地滑动来刷所有单元格的菜单.我想要的是,当我在另一个单元格上滑动时,前一个单元格应该转到其原始状态. 这是我的单元格代码 -(UITableViewCell*)tableView:(UITableView *)tableView 我正在使用SWtableVIEwCell在tableVIEw中显示我的frIEndsList.根据代码一切正常.问题是,我一次只需要一个活动单元.现在我可以通过一个接一个地滑动来刷所有单元格的菜单.我想要的是,当我在另一个单元格上滑动时,前一个单元格应该转到其原始状态.

这是我的单元格代码

-(UItableVIEwCell*)tableVIEw:(UItableVIEw *)tableVIEw cellForRowAtIndexPath:(NSIndexPath *)indexPath{NSMutableArray *leftUtilitybuttons = [NSMutableArray new];[leftUtilitybuttons sw_addUtilitybuttonWithcolor: [UIcolor colorWithRed:0.07 green:0.75f blue:0.16f Alpha:1.0]                                            icon:[UIImage imagenamed:@"about-icon-md.png"]];[leftUtilitybuttons sw_addUtilitybuttonWithcolor: [UIcolor colorWithRed:0.07 green:0.75f blue:0.16f Alpha:1.0]                                            icon:[UIImage imagenamed:@"chat-4-64.png"] ];static Nsstring* IDentifIEr=@"addContactCell";Cell *cell=(Cell *)[tableVIEw dequeueReusableCellWithIDentifIEr:IDentifIEr];Cell __weak * weakCell = cell;[cell setAppearanceWithBlock:^{    weakCell.containingtableVIEw = tableVIEw;    weakCell.leftUtilitybuttons = leftUtilitybuttons;    weakCell.delegate = self;} force:NO];if (cell==nil){    SWtableVIEwCell *cell = (SWtableVIEwCell *)[tableVIEw dequeueReusableCellWithIDentifIEr:IDentifIEr];    if (cell == nil) {        cell = [[SWtableVIEwCell alloc] initWithStyle:UItableVIEwCellStyleSubTitle                                      reuseIDentifIEr:IDentifIEr                                  containingtableVIEw:self.table // Used for row height and selection                                   leftUtilitybuttons:leftUtilitybuttons                                  rightUtilitybuttons:nil];        cell.delegate = self;    }    return  cell;    }cell.backgroundcolor=[UIcolor clearcolor];[cell.contentVIEw.layer setbordercolor:[UIcolor colorWithRed:0.15f green:0.47f blue:0.17f Alpha:0.1].CGcolor];[cell.contentVIEw.layer setborderWIDth:1.0f];indexvalueRow = indexPath.row;indexValueSection =indexPath.section;frIEndUser= [self findFrIEndUser];[frIEndUser fetchIfNeededInBackgrounDWithBlock:^(PFObject *object,NSError *error) {    if (!error)    {        if (object) {        NSLog(@"frIEnd user = %@",frIEndUser);        Nsstring *frIEndname = [Nsstring stringWithFormat:@"%@ %@",frIEndUser[@"Firstname"],frIEndUser[@"Lastname"] ];        cell.nameLabel.text= frIEndname;        cell.nameLabel.textcolor = [UIcolor darkGraycolor];        PFfile *userImagefile = frIEndUser[@"profilePic"];        [userImagefile getDataInBackgrounDWithBlock:^(NSData *imageData,NSError *error)         {             if (!error) {                 //NSLog(@"%@",imageData);                 cell.profileImage.image = [UIImage imageWithData:imageData];             }         }];        }}}];return cell;

}

解决方法 实现这个委托方法也是..

- (BOol)swipeabletableVIEwCellShouldHIDeUtilitybuttonsOnSwipe:(SWtableVIEwCell *)cell {    return YES;}
总结

以上是内存溢出为你收集整理的ios7 – SWTableViewCell一次显示一个菜单全部内容,希望文章能够帮你解决ios7 – SWTableViewCell一次显示一个菜单所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1057439.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-25
下一篇2022-05-25

发表评论

登录后才能评论

评论列表(0条)

    保存