Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/rust/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 获取UITableView的IndexPath以更改UIView的颜色_Ios_Objective C_Uitableview_Uiview_Didselectrowatindexpath - Fatal编程技术网

Ios 获取UITableView的IndexPath以更改UIView的颜色

Ios 获取UITableView的IndexPath以更改UIView的颜色,ios,objective-c,uitableview,uiview,didselectrowatindexpath,Ios,Objective C,Uitableview,Uiview,Didselectrowatindexpath,我在我的tableViewCell左侧添加了一个徽章,如中所示。 成功完成后,我开始下一步,即在单元格上添加左/右滑动,并显示一些选项。我已经通过在GitHub上使用成功地配置了它。现在,随着我的前进,我在右击上添加了一个取消选项,用户点击它,我希望徽章(UIView)颜色变为红色。 我已将绿色添加到它,作为appointmentCell.appointmentStatusIndicatorBadge.layer.backgroundColor=[UIColor greenColor].CGCo

我在我的
tableViewCell
左侧添加了一个徽章,如中所示。 成功完成后,我开始下一步,即在单元格上添加左/右滑动,并显示一些选项。我已经通过在GitHub上使用成功地配置了它。

现在,随着我的前进,我在右击上添加了一个取消选项,用户点击它,我希望徽章(UIView)颜色变为红色。
我已将绿色添加到它,作为
appointmentCell.appointmentStatusIndicatorBadge.layer.backgroundColor=[UIColor greenColor].CGColor因此,如果我在索引中的DidTriggerLeftUtilityButtonWithinIndex中再次调用此行,它不会选择
任命状态指示器边沿
,因为它是在
PatientPointmentTableViewCell
中创建的,作为
@属性(弱、非原子)IBUIView*任命状态指示器边沿并且它正在PatientViewController中使用

以下是我需要访问的完整方法:

- (void)swipeableTableViewCell:(SWTableViewCell *)cell didTriggerLeftUtilityButtonWithIndex:(NSInteger)index {
    switch (index) {
        case 0:
        {
            NSLog(@"Just Tapped Cancel");
//here I want to change the color to red
            [cell hideUtilityButtonsAnimated:YES];
            break;
        }
        default:
            break;
    }
}
我试图通过制作一个新的课堂对象来做到这一点,但那是一件愚蠢的事情。问题是现在我无法跟踪
indepath
,因为我不再在
TableView
的委托方法中。那我该怎么做呢


编辑
根据注释,这里是我的tableViewCell的.h代码。我没有在.h文件中做任何事情

#import <UIKit/UIKit.h>
#import "SWTableViewCell.h"

@interface PatientAppointmentTableViewCell : SWTableViewCell
@property (weak, nonatomic) IBOutlet UIView *appointmentStatusIndicatorBadge;
@end
#导入
#导入“SWTableViewCell.h”
@接口PatientPointmentTableViewCell:SWTableViewCell
@属性(弱、非原子)IBUIView*任命状态指示器边界;
@结束

使用以下代码获取单元格的indexPath:

NSLog(@"Just Tapped Cancel");
NSIndexPath *indexPath = [tableView indexPathForCell:cell];
鉴于,
单元格
是以下方法中的
单元格

- (void)swipeableTableViewCell:(SWTableViewCell *)cell didTriggerLeftUtilityButtonWithIndex:(NSInteger)index 

方法。

你能显示你的表格单元格类吗?@Mr.UB查看我问题的编辑版本。你有一个变量可以用来存储一个标志,以查看用户是否按下了取消按钮吗?@Mr.UB当用户用这个
didTriggerLeftUtilityButtonWithinIndex
SWTableViewCell
类的委托方法按下取消按钮时,我就知道了。我只想知道它按下“取消”按钮的indexPath。