如何在使用moveRowAtIndexPath:方法时替换默认图片
2016-12-14 14:25
495 查看
在用- (void)tableView:(UITableView *)tableView
moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath方法实现重排时,有一个三条线的默认图片,下面的方法可以实线替换默认图片
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell
forRowAtIndexPath:(NSIndexPath *)indexPath{
for (UIView *viewin cell.subviews)
{
if ([[[viewclass]
description]isEqualToString:@"UITableViewCellReorderControl"]) {
for (UIView *vin view.subviews)
{
if ([visKindOfClass:[UIImageViewclass]])
{
[v removeFromSuperview];
}
}
UIImageView *imageView = [[UIImageViewalloc]initWithFrame:CGRectMake(5,5,
35,35)];
imageView.image = [UIImageimageNamed:@"change.png"];
[view addSubview:imageView];
}
}
}
或者在自定义的cell的m文件中添加如下方法
- (void)layoutSubviews{
[super layoutSubviews];
for (UIView *view
in self.subviews) {
if ([[[view class] description] isEqualToString:@"UITableViewCellReorderControl"]) {
for (UIView *v
in view.subviews) {
if ([v isKindOfClass:[UIImageView class]]) {
[v removeFromSuperview];
}
}
UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(5,
5, 35,
35)];
imageView.image = [UIImage imageNamed:@"change.png"];
[view addSubview:imageView];
}
}
<
b789
p style="margin-top:0px;margin-bottom:0px;line-height:normal;font-family:Menlo;">
}
moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath方法实现重排时,有一个三条线的默认图片,下面的方法可以实线替换默认图片
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell
forRowAtIndexPath:(NSIndexPath *)indexPath{
for (UIView *viewin cell.subviews)
{
if ([[[viewclass]
description]isEqualToString:@"UITableViewCellReorderControl"]) {
for (UIView *vin view.subviews)
{
if ([visKindOfClass:[UIImageViewclass]])
{
[v removeFromSuperview];
}
}
UIImageView *imageView = [[UIImageViewalloc]initWithFrame:CGRectMake(5,5,
35,35)];
imageView.image = [UIImageimageNamed:@"change.png"];
[view addSubview:imageView];
}
}
}
或者在自定义的cell的m文件中添加如下方法
- (void)layoutSubviews{
[super layoutSubviews];
for (UIView *view
in self.subviews) {
if ([[[view class] description] isEqualToString:@"UITableViewCellReorderControl"]) {
for (UIView *v
in view.subviews) {
if ([v isKindOfClass:[UIImageView class]]) {
[v removeFromSuperview];
}
}
UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(5,
5, 35,
35)];
imageView.image = [UIImage imageNamed:@"change.png"];
[view addSubview:imageView];
}
}
<
b789
p style="margin-top:0px;margin-bottom:0px;line-height:normal;font-family:Menlo;">
}
相关文章推荐
- 你最喜欢的图片替换方法是什么,你如何选择使用?
- 你最喜欢的图片替换方法是什么,你如何选择使用?
- 你最喜欢的图片替换方法是什么,你如何选择使用?
- 你最喜欢的图片替换方法是什么,你如何选择使用?
- 你最喜欢的图片替换方法是什么,你如何选择使用?
- 你最喜欢的图片替换方法是什么,你如何选择使用?
- 你最喜欢的图片替换方法是什么,你如何选择使用?
- 你最喜欢的图片替换方法是什么,你如何选择使用?
- 你最喜欢的图片替换方法是什么,你如何选择使用?
- 你最喜欢的图片替换方法是什么,你如何选择使用?
- 你最喜欢的图片替换方法是什么,你如何选择使用?
- 你最喜欢的图片替换方法是什么,你如何选择使用?
- python使用正则表达式分析网页中的图片并进行替换的方法
- PPT 链接图片 默认使用IE打开的解决方法
- 文件加密的一种方法——如何使用Copy命令把文件和图片“复制”在一起
- 使用jQuery处理图片找不到时的替换方法
- 如何使用JS脚本从HTML中分离图片标签与文本,替换文本中指定的内容并加粗(原创)
- TotalCommander使用方法,如何对图片批量重命名
- JS字符串替换函数全部替换方法 JS 正则表达式如何使用变量
- ps如何去掉图片水印 PS使用仿制图章工具去除水印方法图解