__bridge
作为OC与C语言之间的桥接符号使用,
简单的用法:
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
char *str = "str";
method5(str);
// NSString *name = @"name";
// method5((__bridge void*)(name));
}
void method5(void * str){
// NSString *name = (__bridge NSString *)(str);
// NSLog(@"method5:%@",name);
NSLog(@"C-Str : %s",str);
}
网友评论