簡単な方法は、UITableViewCell
をサブクラス化し、layoutSubviews
メソッドをオーバーライドすることです。
ここでは簡単な例を示します。
@interface CustomCell : UITableViewCell
@end
@implementation CustomCell
- (void)layoutSubviews
{
[super layoutSubviews];
// grab bound for contentView
CGRect contentViewBound = self.contentView.bounds;
if(self.imageView.image) {
// do stuff here, for example put the image right...
CGRect imageViewFrame = self.imageView.frame;
// change x position
imageViewFrame.postion.x = contentViewBound.size.width - imageViewFrame.size.width;
// assign the new frame
self.imageView.frame = imageViewFrame;
}
else {
// do stuff here
}
}
特に、このメソッドの内部では、image
に応じてセルのコンポーネントを配置できます。
希望します。
はい私はちょうどこの行に沿って何かを試していた、私は正しい道にいることをいくつかの安心を得ることは良いです。ありがとう! – Darren