Iphone UITableViewCell子类显示的大小不正确
我为我创建的UITableViewCell子类创建了一个nib文件,它的高度在nib中设置为25,但是当应用程序加载时,情况并非如此。它将加载到默认大小。下面是我的代码,用于实现该单元Iphone UITableViewCell子类显示的大小不正确,iphone,objective-c,uitableview,subclass,Iphone,Objective C,Uitableview,Subclass,我为我创建的UITableViewCell子类创建了一个nib文件,它的高度在nib中设置为25,但是当应用程序加载时,情况并非如此。它将加载到默认大小。下面是我的代码,用于实现该单元 // Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"MyCell";
MyCell *cell = (MyCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
[[NSBundle mainBundle] loadNibNamed:@"MyCell" owner:self options:nil];
//cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
cell = choreCell;
}
return cell;
}
我尝试过用cell.frame=CGRectMake(0,0320,25)设置框架,但它不起作用。有什么想法吗?单元格高度在表视图委托的
-(CGFloat)tableView:(UITableView*)tableView heightForRowAtIndexPath:(nsindepath*)indepath
方法中指定