Apple开发_CGImageRef与NSValue的相互转换

- (void)test {
    UIImage *image = GC_Image(@"🍅");
    CGImageRef image_ref = image.CGImage;
    NSValue *image_value = [NSValue valueWithPointer:image_ref];
    image_ref = (CGImageRef)[image_value pointerValue];
    
    [self my_method:image_value];
    
    [self my_method:@(2)];
    [self my_method:@{@"2345" : @(4)}];
    [self my_method:@[@"3", @(8)]];
    [self my_method:[UIImage imageNamed:@"12345"]];
    [self my_method:[UIView class]];
    [self my_method:[[UIView alloc] init]];
}

- (void)my_method:(id)obj_para {
    CHLog(@"obj_para == %@", obj_para);
}
posted @ 2024-11-12 10:28  CH520  阅读(2)  评论(0编辑  收藏  举报