便捷使用block方法】的更多相关文章

1,便捷声明block属性 @property (nonatomic ,strong) void(^clickBlock)(void); 注: 1)参数要在括号里即使空参数 2)ARC下没有了栈block,strong or copy修饰都可 2,block做参数 - (void)testBlockParameter:(typeof(void(^)(NSString *info)))testBlock; 1)不可以声明block名称 2)用typeof()定义…
#import "ViewController.h" #import "Header.h" @interface ViewController () <NSURLConnectionDataDelegate> @property (nonatomic, strong) NSMutableArray *dataArray; @end @implementation ViewController // 懒加载 - (NSMutableArray *)data…
MJRefresh实现刷新(使用它的Block方法)   // // YFMVCPostListViewController.m // iOS122 // // Created by 颜风 on 15/10/14. // Copyright (c) 2015年 iOS122. All rights reserved. // #import "YFMVCPostListViewController.h" #import "YFArticleModel.h" #impo…
#import "ViewController.h" #import "Header.h" @interface ViewController ()<NSURLSessionDataDelegate> /** * 用于保存相关的数据 */ @property (nonatomic, strong) NSMutableData *resultData; @end @implementation ViewController - (void)viewDidL…
前言:AutoMapper的下载安装我就不多说了,网上百度一大堆.今天我就说说它的更为简单的使用,什么叫更为简单呢?按照一般的使用方法,我们首先建DTO,然后建每个对应的Profile,然后还要把每个Profile给Initialize,最后Global里AutoMapper.Configuration.Configure(),我个人觉得比较麻烦,如果一两个映射还好,多了的话就显得很麻烦了,下面来说说我个人觉得挺方便的一个方法. 1.第一步当然必须建立DTO,就不多说了. 2.Appstart里…
+(LDLabel *)labelWithFrame:(CGRect)frame withTitle:(NSString *)title withFont:(float)font withtextColor:(UIColor *)textColor withBackColor:(UIColor *)backColor{ LDLabel *label = [LDLabel new]; label.frame = frame; label.text = title; label.textColor…
#import "ViewController.h" #import "Header.h" @interface ViewController ()<NSURLSessionDataDelegate> @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view…
方式一.在传参时直接声明block回调方法. 1. 定义方法: - (int)doTest:(NSString *)name para1:(int)temp1 para2:(int)temp2 success:(int (^)(int param1, int param2))success { int ret = success(temp1, temp2); NSLog(@"----%@ -- %d--", name, ret); return ret; } 2. 调用方法: [sel…
方式一.在传参时直接声明block回调方法. 1. 定义方法: - (int)doTest:(NSString *)name success:(int (^)(int param1, int param2))success para1:(int)temp1 para2:(int)temp2 { int ret = success(temp1, temp2); NSLog(@"----%@ -- %d--", name, ret); return ret; } 2. 调用方法: [sel…
通常都是这样创建alert 再加一个代理 // 创建一个UIAlertView并显示出来 UIAlertView *alertview = [[UIAlertView alloc] initWithTitle:aTitle message:msg delegate:self cancelButtonTitle:str otherButtonTitles:nil]; [alertview show]; -(void) alertView:(UIAlertView *)alertView click…