iOS 自定义cell高度(非等高)

  • 小编实在不想多说什么了,直接上代码吧.我觉得我的主要注释写的已经很清楚了.

  • 在此说明小编这里用的是xib的写法,如果在其中的运行中有什么问题,请放心评论,我会在第一时间为大家解答.谢谢支持

代码案例

1.#import <UIKit/UIKit.h>

@interface ZJStatuesTableViewController : UITableViewController

@end

2.#import "ZJStatuesTableViewController.h"
#import "ZJStatuesTableViewCell.h"
#import "ZJStatus.h"

@interface ZJStatuesTableViewController ()

/** 存放数据的数组 */
@property (strong, nonatomic) NSArray *statuses;

@end

@implementation ZJStatuesTableViewController
/**
 *  懒加载
 *
 */
- (NSArray *)statuses
{
    if (_statuses == nil) {
        // 加载plist中的字典数组
        NSString *path = [[NSBundle mainBundle] pathForResource:@"statuses.plist" ofType:nil];
        NSArray *dictArray = [NSArray arrayWithContentsOfFile:path];

        // 字典数组 -> 模型数组
        NSMutableArray *statusArray = [NSMutableArray array];
        for (NSDictionary *dict in dictArray) {
            ZJStatus *status = [ZJStatus statusWithDict:dict];
            [statusArray addObject:status];
        }

        _statuses = statusArray;
    }
    return _statuses;
}

- (void)viewDidLoad {
    [super viewDidLoad];

}

#pragma mark - Table view data source
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    // 返回多少行,通过数组中的个数
    
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值