开发者

UITableViewCell subclass not showing correct size

I have a nib file for a UITableViewCell subclass I made, it's height is set to 25 in the nib, however when the application loads, this is not the case. It loads to the default size. Here is my code for the implementation of the cell.

    // 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 ce开发者_如何学Pythonll;
}

I've tried setting the frame with cell.frame = CGRectMake(0, 0, 320, 25) however it didn't work. Any ideas?


The cell height is specified in the -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath method of your table view's delegate.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜