Callback methods from C to Objective-C

前端 未结 4 1323
伪装坚强ぢ
伪装坚强ぢ 2021-01-21 07:03

I have an Objective-C class. What I am doing is I am calling C functions in my objective-C class [ This C functions I implemented in one file , which is part in this sample ios

4条回答
  •  無奈伤痛
    2021-01-21 07:12

    even in Blocks also you can't access instance variables right. Please check the following code snippet.

    // this is simple block code

    NSString* (^trimTheStr)(NSString*) = ^(NSString *str) {

    [self myInstanceMethods]; // This will show error right 
    
    NSString *result = nil;
    
    result = [str stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
    
    return result;
    

    };

提交回复
热议问题