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"];

  • 相关阅读:
    H5新增属性02
    h5新增属性
    javascript基础
    多列布局和弹性盒模型详解
    边框图片+盒子倒影
    CSS新增边框属性
    css3选择器
    css3基础
    h5新增-2
    h5新增
  • 原文地址:https://www.cnblogs.com/popper123/p/4763211.html
Copyright © 2011-2022 走看看