我怎么能够把UIImage存放在NSDictionary?
I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...
我怎么能够把UIImage存放在NSDictionary?
是:
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithCapacity:1];
UIImage *img = ...;
[dict setObject:img forKey:@"aKeyForYourImage"];
UIImage *imgAgain = [dict objectForKey:@"aKeyForYourImage"];
科索沃我最近曾有过这个问题,上述解决办法对我从未奏效。 因此,如果其他人在这里找到了解决同一问题的途径,那么,这里是怎样做的。
NSDictionary *imageDictionary = @{
kImageKey: UIImageJPEGRepresentation(/*INSERT YOUR UIImage HERE*/,0.1)
};
0.1 表示压缩质量0.0 最低到1.0 是最高质量
然后从字典使用中恢复图像
[UIImage imageWithData:[imageDictionary objectForKey: kImageKey]];
您不能将UIImage物体储存在字典里。 你们必须把图像转换成NSData物体,并储存在字典上。
NSData *imgData = UIImageJPEGRepresentation(yourImage, 0.0f);
[dictionary setObject:imgData forKey:@"your key"];
<代码>[字典] 反对:yourImage forKey:@“whatever key You Hope”];
未经测试
[法令:Key:@“Image ToStore”];
这取决于你们想要做什么。 虽然是,你可以在NSDictionary储存一台UIImage,但在你需要符合某些标准的情形下,你可能无法使用上述字典物体。
例如,你可以使用NSDictionary作为标准价值。 用户违约,但只有该词的每个物体是财产清单标的。 UIImage不是财产清单标的。 NSData是,因此,如上所述,你可以将UIImage转换为NSData,并以此方式储存。
I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...
HI, In our application i am using corelocationframework when opening application a alert for allow and dont allow.when clicking on the allow for current location we will show current location.When ...
Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...
我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......
我希望我与四舍五入的累进角进行网上讨论。
我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。
We have a restaurant table that has lat-long data for each row. We need to write a query that performs a search to find all restaurants within the provided radius e.g. 1 mile, 5 miles etc. We have ...
I like to write bash shell scripts on my iPhone, put them in an app folder with an icon, plist, etc., so they execute like apps by tapping their icon on SpringBoard. This is not interactive like ...