简书黑色代码块设置

2019-07-22  本文已影响0人  杰小冷_4957

简书代码块黑色设置

这一部分网上方法很多,看自己怎么理解了,我来说下一个比较简单的方式以及我自己遇到过的坑。

1、新建文章之前先选择Markdown编辑器。如果是新建后在选择编辑器不生效。
2、中文和英文输入法不影响。
3、输入的时候先输入三个空格或者4个空格就可以生成代码块。

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.section == 0) {
    BannerTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"BannerTableViewCell" forIndexPath:indexPath];
    cell.layer.cornerRadius  = 3;
    cell.layer.masksToBounds = YES;
    return cell;
}else{
    SuoTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SuoTableViewCell" forIndexPath:indexPath];
    if (self.dataArr.count > 0) {
        NSDictionary *dic = self.dataArr[indexPath.section-1];
        NSArray *arr = dic[@"list"];
        if (arr.count > 0) {
            NSDictionary *dicdata = arr[indexPath.row];
            if ([[NSString stringWithFormat:@"%@",dicdata[@"lockAlias"]] isEqualToString:@"<null>"] ) {
                cell.name.text = @"门锁";
            }else{
                cell.name.text =  [NSString stringWithFormat:@"%@",dicdata[@"lockAlias"]];
            }
            
            NSArray *arr = @[@"办公室门锁",@"大门锁",@"防盗门锁"];
            
            NSString *index = dicdata[@"iconIndex"];
            
            cell.headImg.image = [UIImage imageNamed:arr[index.intValue]];
        }
    }
    return cell;
}

return nil;

}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.section == 0) {
    BannerTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"BannerTableViewCell" forIndexPath:indexPath];
    cell.layer.cornerRadius  = 3;
    cell.layer.masksToBounds = YES;
    return cell;

中间插入不影响

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.section == 0) {
    BannerTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"BannerTableViewCell" forIndexPath:indexPath];
    cell.layer.cornerRadius  = 3;
    cell.layer.masksToBounds = YES;
    return cell;


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.section == 0) {
    BannerTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"BannerTableViewCell" forIndexPath:indexPath];
    cell.layer.cornerRadius  = 3;
    cell.layer.masksToBounds = YES;
    return cell;
}else{
    SuoTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SuoTableViewCell" forIndexPath:indexPath];
    if (self.dataArr.count > 0) {
        NSDictionary *dic = self.dataArr[indexPath.section-1];
        NSArray *arr = dic[@"list"];
        if (arr.count > 0) {
            NSDictionary *dicdata = arr[indexPath.row];
            if ([[NSString stringWithFormat:@"%@",dicdata[@"lockAlias"]] isEqualToString:@"<null>"] ) {
                cell.name.text = @"门锁";
            }else{
                cell.name.text =  [NSString stringWithFormat:@"%@",dicdata[@"lockAlias"]];
            }
            
            NSArray *arr = @[@"办公室门锁",@"大门锁",@"防盗门锁"];
            
            NSString *index = dicdata[@"iconIndex"];
            
            cell.headImg.image = [UIImage imageNamed:arr[index.intValue]];
        }
    }
    return cell;
}

return nil;

}

复制代码的时候上面 }不在代码块里面的时候,在这个前面输入三个或者四个空格。

上一篇 下一篇

猜你喜欢

热点阅读