式守同学不只可爱而已剧情简介

" ]; UIColor *color = [UIColor colorWithRed:0.902f green:0.886f blue:0.863f alpha:1.0f]; self.tableView.backgroundColor = color; self.tableView.separatorColor = [UIColor clearColor]; self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;}- (void)viewDidLoad { [super viewDidLoad]; [self.tableView registerClass:[NewsTitleCell class] forCellReuseIdentifier:@"cell"]; [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cellOther"];}#pragma mark - Table view data source- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return _titleArr.count * 2;}- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.row % 2 == 0) { NewsTitleCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath]; cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.titleLabel.text = _titleArr[indexPath.row/2]; cell.summaryLabel.text = _summaryArr[indexPath.row/2]; return cell; } else { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cellOther" forIndexPath:indexPath]; cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.textLabel.numberOfLines = 0; cell.textLabel.lineBreakMode = NSLineBreakByCharWrapping; cell.textLabel.text = _summaryArr[indexPath.row/2]; return cell; }}- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.row % 2 != 0) { return 40 [self calculateSizeWithString:_summaryArr[indexPath.row/2] font:[UIFont systemFontOfSize:14] maxW:kWindowW - 30].height; } else { return 80.0f; }}- (CGSize)calculateSizeWithString:(NSString *)string font:(UIFont *)font maxW:(CGFloat)maxW{ CGSize maxSize = CGSizeMake(maxW, MAXFLOAT); // 计算文字 CGRect rect = [string boundingRectWithSize:maxSize options:nil attributes:nil context:nil]; NSDictionary *dict = @{NSFontAttributeName : font}; CGRect rect = [string boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:dict context:nil]; CGSize size = rect.size; return size; }@end

猜你喜欢

我独自升级第二季

2025/日本/韩国/剧情,动作,动画,奇幻,冒险

小七和奶龙

2020/大陆/动画

心奇爆龙战车7之巨兽战龙

2024/中国大陆/科幻,动画,儿童,奇幻,冒险,中国动漫,动漫

亦叶亦花

2024/日本/剧情,动画

美食大冒险第一季

2014/大陆/喜剧,动作,动画,儿童,奇幻,冒险

妖精的尾巴

2009/日本/动画