我使用soap方法来使用Web服务,响应在wsdl中,xml图像标记包含cdata,我想知道如何使用这种类型的数据创建uiimage。
NSData* imageData = [[[[servicesArray objectAtIndex:indexPath.row]valueForKey:@"image"] valueForKey:@"text"] dataUsingEncoding:NSUTF8StringEncoding];
UIImage* image = [[UIImage alloc] initWithData:imageData];//[UIImage imageWithData:imageData];
但我的结果是零 这是cdata
<image><![CDATA[iVBORw0KGgoAAAANSUhEUgAAAG4AAABACAIAAAB0n9XqAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAJ8SURBVHhe7ZRhbttQDIN3gt2kp+j9z7QJkENolN6zkipZ45L4fkgUHcCE21+/Pz7FCKpyDFU5hqocQ1WOoSrHUJVjqMoxVOUYqnIMVTmGqhxDVY6hKsdQlWOoyjFU5RiPVPnnJvJL+sl358Gvsl9QP/nuPL3Kn8NJlV6ZKTsmWk1wKFwmL8auSrwwXj4P/esqcBm6X6UJaxxKE8NqxnAlTr5Kf+HN0L+uApfhjq/SlB0Ip03GFQM2X4aTKkWfb1rl8dE2Pttm7AWoyjFU5Rjf939ls6Nm7AW8d5WdzMt4VpVff8nOL5QZN6HySmamGYssq/TfgujqHLeb8ik6ME0dPzuZnCGHVjhZMdOPReoq42NxBm6ayMmrDyTEnL5JPJDx1QQHZnZM2YxO5LzKTHkl01cXTPjRucuMnAacGPPZhGvpH8tZjHi8ylI5Ayf6e8dZ+eA04FCMVkA+rWDlG63/ldmPTskmRidawcoH+4BfIfKxAvJpBSvfWFYJ/GFTXHFdsYnFU5wJP5nId05PprjSFSsgn1aw8o3zKo34fJw37GO4Ysj4yUS+cRzWp41D68rMzsoE/7NKF50iq8BdPpm0rszsrExwd5V5Ldln/OqiU6QMlKaTT+6YyMFaOqWZHaKuMj4W5+iYokk0AybyI0ciZGgl/Gqi1UQZCuAKou+zCdeSXZUQXZ3j9q/oijVzGgCehOhKHKGb4JRXk/vEcQuiQEnrD/ytoS5oXdGMRVRlTTMWuX6VRLOjZiyiKmuasYiqrGnGIqqyphmLqMqaZizy46p8HqpyDFU5hqocQ1WOoSrHUJVjqMoxVOUYqnIMVTmGqhxDVY6hKof4+PwLbB/absrmp4YAAAAASUVORK5CYII=]]></image>
这是我的nsdata
202020 20695642 4f527730 4b47676f 41414141 4e535568 45556741 41414734 41414142 41434149 41414142 306e3958 71414141 4141584e 53523049 41727334 63365141 41414152 6e515531 42414143 786a7776 38595155 41414141 4a634568 5a637741 4144734d 41414137 44416364 76714751 4141414a 38535552 42564868 65375a52 68627474 5144494e 33677432 6b702b6a 397a3751 4a6b454e 6f6c4e36 7a6b6970 5a34354c 34666b67 55486343 4532312b 2f507a37 46434b70 79444655 3568716f 63513157 4f6f5372 48554a56 6a714d6f 78564f55 59716e49 4d56546d 47716878 44565936 684b7364 516c574f 6f796a46 55355269 5056506e 6e4a764a 4c2b736c 33353847 76736c39 51502f6e 75504c33 4b6e384e 4a6c5636 5a4b5473 6d576b31 774b4677 6d4c3861 75537277 77586a34 502f6573 7163426d 36583655 4a617878 4b45384e 71786e41 6c547235 4b662b48 4e304c2b 75417066 686a712f 536c4230 49703033 4746514d 32583461 544b6b57 66623172 6c386445 32507474 6d374157 6f796a46 5535526a 66393339 6c73364e 6d374157 38643557 647a4d74 34567056 6666386e 4f4c3551 5a4e3648 79536d61 6d475973 73712f54 6667756a 71484c65 6238696b 364d4530 64507a75 5a6e4347 48566a68 5a4d644f 5052656f 7134324e 78426d36 61794d6d 72447954 456e4c35 4a504a44 78315151 485a6e5a 4d325978 4f354c7a 4b54486b 6c303163 5854506a 52756375 4d6e4161 63475050 5a684776 70483874 5a6a4869 38796c49 35417966 36653864 5a2b6541 30344643 4d566b41 2b725744 6c473633 2f6c646d 5054736b 6d526964 6177636f 482b3442 6649664b 7841764a 70425376 66574659 4a2f4746 54584846 6473596e 46553577 4a50356e 49643035 5070726a 53465373 676e3161 77386f33 7a4b6f33 34664a77 3337474f 3459736a 34795553 2b63527a 57703431 44363872 4d7a736f 452f374e 4b463530 69713842 6450706d 3072737a 73724578 77643556 354c646c 6e2f4f71 69553651 4d6c4b61 54542b36 59794d46 614f7157 5a48614b 754d6a34 57352b69 596f6b6b 30417962 79493063 695a4767 6c2f4771 69315551 5a437541 4b6f752b 7a436465 53585a55 51585a33 6a39712f 6f696a56 7a476743 65684f68 4b484b47 62344a52 586b2f76 45635175 6951456e 72442f79 746f5335 6f586447 4d525652 6c54544d 57755836 56524c4f 6a5a6979 694b6d75 61735969 7172476e 47497171 7970686d 4c714d71 615a697a 79343670 38487170 79444655 3568716f 63513157 4f6f5372 48554a56 6a714d6f 78564f55 59716e49 4d56546d 47716878 44565936 684b6f66 342b5077 4c62422f 61627372 6d703459 41414141 41535556 4f524b35 43594949
请帮助我,
由于
答案 0 :(得分:0)
首先,您必须将CData转换为NSData:
NSData *myData = (__bridge NSData*)my_cfdata;;
然后使用它来获取UIImage: -
UIImage* image = [[UIImage alloc] myData];