我使用的是同一個JSON文件,以填補一個UITableView,這裏是我使用的是什麼在CustomCell一個通用的應用程序:
- (void)layoutSubviews {
[super layoutSubviews];
if (UI_USER_INTERFACE_IDIOM()== UIUserInterfaceIdiomPad) {
self.imageView.frame = CGRectMake(0,0,300,100);
}else if (UI_USER_INTERFACE_IDIOM()== UIUserInterfaceIdiomPhone){
self.imageView.frame = CGRectMake(0,0,180,60);
}
float limgW = self.imageView.image.size.width;
if(limgW > 0) {
if (UI_USER_INTERFACE_IDIOM()== UIUserInterfaceIdiomPad) {
self.textLabel.frame = CGRectMake(320,self.textLabel.frame.origin.y,self.textLabel.frame.size.width,self.textLabel.frame.size.height);
}else if (UI_USER_INTERFACE_IDIOM()== UIUserInterfaceIdiomPhone){
self.textLabel.frame = CGRectMake(182,self.textLabel.frame.origin.y,self.textLabel.frame.size.width,self.textLabel.frame.size.height);
}
}
}
你繼承你的tableviewcell ...按照這個http://stackoverflow.com/questions/2788028/how-do-i-make-uitableviewcells-imageview-a-fixed-size-even-when-the-image-is-sm – user523234