zoukankan      html  css  js  c++  java
  • 代码简化

    简化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的所有操作
     
  • 相关阅读:
    springboot、监听器
    springboot、拦截器
    Thymeleaf模板引擎
    springboot-banner.txt
    springboot,swagger2
    springboot 热部署
    判断是否为微信环境下打开的网页
    后台接收json数据
    ios 面试题
    iOS 适配问题
  • 原文地址:https://www.cnblogs.com/sixindev/p/4790143.html
Copyright © 2011-2022 走看看