zoukankan      html  css  js  c++  java
  • 自定义Operation

    1.要自定义一个Operation 首先要创建一个继承于NSOperation的类。

    2.在创建好的类的.h文件声明自定义的方法:-(instancetype)initWithDownLoadMessage:(NSString *)url;

    3.在创建好的类的.m文件实现自定义方法:

    -(instancetype)initWithDownLoadMessage:(NSString *)url{

        self =[super init];

        if (self) {

            URLString =url;

        }

        return self;

    }

    4.然后我们只需要在需要用到的类里面导入之前创建号的类:#import “DownLoadOperation.h"

    5.初始化类的对象,应用类方法:

     imageview  =[[UIImageView alloc]initWithFrame:self.view.frame];

        [self.view addSubview:imageview];

        DownLoadOperation *download =[[ DownLoadOperation alloc]initWithDownLoadMessage:@"http://file.bmob.cn/M01/37/F1/oYYBAFXdo8yAFY8QAABIFt81XEM849.png"];

  • 相关阅读:
    colormap
    tensorflow4
    tensorflow3
    attention 机制
    tensorflow2
    Android 再谈handler
    Android表格布局之设置边框
    Android AsyncTask异步加载WebAPI
    Android JPush极光推送应用
    Android规划周期任务
  • 原文地址:https://www.cnblogs.com/popper123/p/4763211.html
Copyright © 2011-2022 走看看