xcode iphone:自定义 cell.accessoryType

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5085403/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 20:17:36  来源:igfitidea点击:

iphone: customise cell.accessoryType

xcode

提问by user629283

hi am doing an iphone twitter app with json and i am wondering if it is possible to set the cell.accessoryType to a image in UITableView? or possible move the image to the right hand side...any clues?

嗨,我正在用 json 做一个 iphone twitter 应用程序,我想知道是否可以将 cell.accessoryType 设置为 UITableView 中的图像?或者可能将图像移动到右侧......有任何线索吗?

回答by Bj?rn Marschollek

Sure. Just use the accessoryViewproperty of UITableViewCell and assign a UIImageView:

当然。只需使用accessoryViewUITableViewCell的属性并分配一个UIImageView

UIImage *image = [UIImage imageNamed:@"fileNameOfYourImage.jpg"]; //or wherever you take your image from
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
cell.accessoryView = imageView;
[imageView release];

回答by Gaurav

No need to use imageview, just provide this for simple arrow.

不需要使用 imageview,只需为简单箭头提供这个。

cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;

cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;