• 代码简化


    简化ViewController代码量

    ESSeparatorInset https://github.com/EnjoySR/ESSeparatorInset

    一行代码移除 UITableView 分割线左边的默认的间距

    用法:

    #import "UIViewController+ESSeparatorInset.h"
    //分割线顶格
    [self setSeparatorInsetZeroWithTableView:self.tableView];//分割线顶格
    //或 自定义间距
    [self setSeparatorInsetWithTableView:self.tableView inset:UIEdgeInsetsMake(0, 8, 0, 8)];

    tableView 空白视图

    UIView *emptyView = [[UIView alloc] initWithFrame:self.tableView.frame];
    
    self.tableView.tableHeaderView = emptyView;
    self.tableView.userInteractionEnabled = NO;
    
    //When you have data you just remove the header and reenable user interaction:
    self.tableView.tableHeaderView = nil;
    self.tableView.userInteractionEnabled = YES;

      

    -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
    {
        if (!_dataArray.count) {
            NSLog(@"eeeeeee");
        }
        return   _dataArray.count;
    }
    

      

    父视图透明子试图不透明,不用superview多添加一层透明subview了

    self.backgroundColor=[UIColor colorWithRed:255 / 255.f green:255 / 255.f blue:255 / 255.f alpha:0.5f];
    
    self.backgroundColor=[[UIColor blackColor] colorWithAlphaComponent:0.5];//半透明
    

      

    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
        //耗时任务
        NSData *jpgData = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"https://www.baidu.com/jpg"]];
        dispatch_sync(dispatch_get_main_queue(), ^{
            //更新UI
        });
    });
    

    UITextView-placeholder

    一行代码设置UITextView的placeholder

      

    https://github.com/ISMeSAM/SAMActionSheet

    https://github.com/ISMeSAM/SAMUIAlertViewEx
    UIActionSheet的分类, 只需一行代码即可完成UIActionSheet的所有操作
     
  • 相关阅读:
    httpclient 5.0 设置超时时间
    httpclient raw请求
    使用EasyUI-datagrid-export.js导出Excel,不导出隐藏列
    ExpressSet 虚拟适配器
    中断模式队列
    autohotkey 线程入门
    读rbtree
    树莓派串口
    MCP3421使用详解
    PMOS开关电路
  • 原文地址:https://www.cnblogs.com/sixindev/p/4790143.html
Copyright © 2020-2023  润新知