How can I store a UIImage in an NSDictionary?

前端 未结 6 1279
无人及你
无人及你 2021-02-01 20:30

How can I store a UIImage in an NSDictionary?

6条回答
  •  名媛妹妹
    2021-02-01 20:30

    Yes you can:

    NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithCapacity:1];
    UIImage *img = ...;
    [dict setObject:img forKey:@"aKeyForYourImage"];
    
    UIImage *imgAgain = [dict objectForKey:@"aKeyForYourImage"];
    

提交回复
热议问题