objective-c - @property (nonatomic, copy) void(^doTransferMsg)(NSString *_msg)
大家讲道理
大家讲道理 2017-04-21 11:15:54
0
2
662

不是很明白
@property (nonatomic, copy) void(^doTransferMsg)(NSString *_msg)

这种声明属性方式。只知道void(^doTransferMsg)这是使用block方式声明方法。

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(2)
Peter_Zhu

Maybe it’s easier to understand this way
.h

typedef void(^doTransferMsg)(NSString *_msg);
@property (nonatomic, copy) doTransferMsg transferMsg;

.m

@synthesize transferMsg;
[self setTransferMsg:^(NSString *str)
{
  NSLog(@"hello %@",str);
}];
transferMsg(@"navy");
transferMsg(@"navy2");
洪涛

You will understand if you think of block as a common type. There is no difference between block and common types here. They just define an attribute of this type.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template