Automatically determining the size of a UITableViewCell
- by hanno
I am trying to determine the size of a UITableCellView. The reason being that I am using one class for different orientations and devices.
The cell contains one subview that is supposed to fill the entire cell. Right know I'm doing this in the UITableViewCell's init method:
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){
//iPad
subv = [[OrbitView alloc] initWithFrame:CGRectMake(52, 5, 660, 420) ];
}else{
//iPhone
subv = [[OrbitView alloc] initWithFrame:CGRectMake(15, 5, 290, 200) ];
}
Clearly, there must be a better way of doing this, without the magic numbers. How/Where should I set the frame of the subview in the UITableViewCell so that it fills the entire UITableViewCell?