Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone UITableViewCell子类显示的大小不正确_Iphone_Objective C_Uitableview_Subclass - Fatal编程技术网

Iphone UITableViewCell子类显示的大小不正确

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

我为我创建的UITableViewCell子类创建了一个nib文件,它的高度在nib中设置为25,但是当应用程序加载时,情况并非如此。它将加载到默认大小。下面是我的代码,用于实现该单元

    // 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
方法中指定