English 中文(简体)
I m试图把图像放在习俗上的UITableViewCell中,但不管怎么说,它都坚持走下去。
原标题:I m trying to center Image in custom UITableViewCell but it sticks to left side no matter what

I ve created a cell prototype in the Xcode 4.2 storyboard that consists of an image view in the center of the cell and some text below it but when I run the app the image is always moved to the left side. I ve made the cell extra tall to ensure it wasn t a height issue. I also played with the autosize settings.

到目前为止,我所尝试的任何东西都不会使图像在实际操作时转移到表ViewCell的中心。

值得注意的是,这纯粹是在《故事书》中进行的。 唯一的法典一是编造一个带有“名称”和“剂量”的物体清单,以及最低表率源/分类代码,以便我能够填写表中的两个条目。

最佳回答

我有一些东西在SOS4.x中只是细微的,但与你在SOS 5模拟器中描述的相似,使UIImage的电文由于不明显的理由而下降约120px。 在盒子之外(如果是这样的话)设置了最高位置,从而确定问题——尽管我不清楚为什么在“Si”和“以前”中改变了这种行为。

问题回答

我恳请大家使用这样的东西:

static NSString *identifier = @"ImageRecordCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];

UILabel *label = (UILabel*)[cell viewWithTag:1];
UIImageView *pic = (UIImageView*)[cell viewWithTag:2];

label.text = @"test";
pic.image = [UIImage imageNamed:@"Default.png"];

return cell;

be sure not to set tag to zero





相关问题
Plist Hierarchy and All Option

I have a string of data in a plist, which I ve got to display, hierarchically like this: Menu>Chapter>SubChapter>item>item details This might be super simple, in my initial menu, how would I have ...

Disable iPhone table rows

Is there any way to disable the "selectibility" of a UITableView row? Example: I would like to make an appointment for a haircut at a certain time with a certain stylist. What gets displayed to a ...

Nonintrusive visual cue for uitableviewcell

I d like to mark a tableview row in some way that shows it has been clicked by the user. I have a large number of rows and want users to know if they have already visited a particular row. This same ...

TableView oval button for Index/counts

Can someone help me create an index/count button for a UITableView, like this one? iTunes http://img.skitch.com/20091107-nwyci84114dxg76wshqwgtauwn.preview.jpg Is there an Apple example, or other ...

Unable to pushViewController for subview

I have a UINavigationController and I have seperate UIViews that I switch between using a UISegmentControl. On switching the views, I add the view as a subview to my navigation controller s view: [...

热门标签