Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/25.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 如何使用objective-C高亮显示表视图中的多行_Ios_Objective C_Uitableview - Fatal编程技术网

Ios 如何使用objective-C高亮显示表视图中的多行

Ios 如何使用objective-C高亮显示表视图中的多行,ios,objective-c,uitableview,Ios,Objective C,Uitableview,如果我触摸第一行,它将高亮显示。若我触摸第二行,第一行高亮显示不在那个里,第二行高亮显示在iOS的表视图中我想突出显示(多个)两行 这是我的密码 使用 UITableView的属性。使用 UITableView的属性。使用 UITableView的属性。使用 UITableView的属性。您可以执行以下操作:if(indepath.row==1){根据需要设置颜色}或者if(indepath.row==2){Set COlor}@Mehul我想用相同的颜色高亮显示两行。如果我触摸行,以下方法将被

如果我触摸第一行,它将高亮显示。若我触摸第二行,第一行高亮显示不在那个里,第二行高亮显示在iOS的表视图中我想突出显示(多个)两行

这是我的密码

使用

UITableView的属性。

使用

UITableView的属性。

使用

UITableView的属性。

使用


UITableView的属性。

您可以执行以下操作:if(indepath.row==1){根据需要设置颜色}或者if(indepath.row==2){Set COlor}@Mehul我想用相同的颜色高亮显示两行。如果我触摸行,以下方法将被调用“-(void)tableView:(UITableView*)tableView DidSelectRowatineXpath:(NSIndexPath*)indexPath”在该方法中有什么方法吗?不要在每次调用CellForRowatineXpath:时向单元格添加UIView子视图!单元实例会被重用,因此重复替换背景视图实例是不必要的。只需设置单元格的背景色,而不是使用selectedBackgroundView。您可以这样做,如果(indexpath.row==1){根据需要设置颜色}或者如果(indexpath.row==2){set color}@Mehul,我想用相同的颜色高亮显示两行。如果我触摸行,以下方法将被调用“-(void)tableView:(UITableView*)tableView DidSelectRowatineXpath:(NSIndexPath*)indexPath”在该方法中有什么方法吗?不要在每次调用CellForRowatineXpath:时向单元格添加UIView子视图!单元实例会被重用,因此重复替换背景视图实例是不必要的。只需设置单元格的背景色,而不是使用selectedBackgroundView。您可以这样做,如果(indexpath.row==1){根据需要设置颜色}或者如果(indexpath.row==2){set color}@Mehul,我想用相同的颜色高亮显示两行。如果我触摸行,以下方法将被调用“-(void)tableView:(UITableView*)tableView DidSelectRowatineXpath:(NSIndexPath*)indexPath”在该方法中有什么方法吗?不要在每次调用CellForRowatineXpath:时向单元格添加UIView子视图!单元实例会被重用,因此重复替换背景视图实例是不必要的。只需设置单元格的背景色,而不是使用selectedBackgroundView。您可以这样做,如果(indexpath.row==1){根据需要设置颜色}或者如果(indexpath.row==2){set color}@Mehul,我想用相同的颜色高亮显示两行。如果我触摸行,以下方法将被调用“-(void)tableView:(UITableView*)tableView DidSelectRowatineXpath:(NSIndexPath*)indexPath”在该方法中有什么方法吗?不要在每次调用CellForRowatineXpath:时向单元格添加UIView子视图!单元实例会被重用,因此重复替换背景视图实例是不必要的。只需设置单元格的背景色,而不是使用selectedBackgroundView。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

UIView *selectionColor = [[UIView alloc] init];
selectionColor.backgroundColor = [UIColor grayColor];
cell.selectedBackgroundView = selectionColor;

}
self.tableView.allowsMultipleSelection = YES;