block写法
//typedef void(^RefreshBlock)(int status);
//@property(nonatomic,copy)RefreshBlock refreshBlock;
.h 声明 有两种方式
①直接声明
@property (nonatomic ,copy) void (^refreshBlock)(int status);
②先用typedef定义,然后在声明
typedef void(^RefreshBlock)(int status);
@interface
@property(nonatomic,copy)RefreshBlock refreshBlock;
.m中赋值
self.successfulChongZhi(1);
其他界面中调用block
view.successfulChongZhi = ^(NSInteger state) {
switch (state) {
case 0:
break;
case 1:
break;
default:
break;
}
};
枚举
.h中定义声明
typedef enum {
XiuGaiMiMaSuccess = 0,
jvBaoSuccess,
} TipType;
@property(nonatomic,assign)TipType tipType;
transform动画
self.whiteContentView.transform = CGAffineTransformMakeScale(0.01, 0.01);//形变,大小变为原来的0.01倍
[UIView animateWithDuration:0.25 animations:^{
self.whiteContentView.transform = CGAffineTransformIdentity;//恢复到原来的大小
} completion:^(BOOL finished) {
}];