【发布时间】:2011-08-23 03:26:41
【问题描述】:
我有两个带有以下声明的表视图。
cAboutUs = [[UITableView alloc] initWithFrame:CGRectMake(85, 272, 227, 30)];
ctableView = [[UITableView alloc] initWithFrame:CGRectMake(85, 302, 227, 100)];
当我尝试使用以下代码添加自定义附件视图时,两者都位于单元格中的不同位置。 (在 cAboutUs 中,与 ctableView 单元格附件相比,它更向左(x))
UIImage *image = [UIImage imageNamed:@"bullet.png"];
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
CGRect frame = CGRectMake(0.0, 0.0, image.size.width, image.size.height);
button.frame = frame;
[button setBackgroundImage:image forState:UIControlStateNormal];
cell.accessoryView = button;
我也尝试过使用
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator
它显示正确且对齐良好。
请帮我解决这个错误。
【问题讨论】:
-
两个table view使用同一张图片,怎么会出问题。
-
你是否同时显示两个表格视图?
标签: iphone ios4 uitableview