小编Kat*_*chi的帖子

如何将图像添加到UITableView单元格?

我暂时以UITableViewCell编程方式添加了一些值.但我需要为每个单元格添加图像.我怎样才能做到这一点?

这是我的代码..h文件

 @interface BidalertsViewController : UIViewController       <UITableViewDelegate,UITableViewDataSource> {
    NSArray *listData;
}
@property(nonatomic, retain) NSArray *listData; 
@end
Run Code Online (Sandbox Code Playgroud)

.m文件

 @synthesize listData;

- (void)viewDidLoad {
UIView *newView = [[UIView alloc] initWithFrame:CGRectMake(5,0,310,28)];
newView.backgroundColor=[UIColor whiteColor];
UITextView *mytext = [[UITextView alloc] initWithFrame:CGRectMake(0.0, 0.0, 100.0, 25.0)];
mytext.backgroundColor = [UIColor clearColor];
mytext.textColor = [UIColor blackColor];
mytext.editable = NO;
mytext.font = [UIFont systemFontOfSize:15];
mytext.text = @"Asset Name";
[mytext release];
[newView addSubview:mytext];

[self.view addSubview:newView];
[newView release];


NSArray *array = [[NSArray alloc] initWithObjects:@"iPhone", @"iPod", @"iPad",nil];
self.listData = array;
[array …
Run Code Online (Sandbox Code Playgroud)

uitableview ios

6
推荐指数
2
解决办法
2万
查看次数

标签 统计

ios ×1

uitableview ×1