开发者

iphone-webservice-image

开发者 https://www.devze.com 2023-03-04 05:39 出处:网络
i want to display image in uitableviewcell, for that in uitableview my data is fetch from webservice and i use xmlparsing for that

i want to display image in uitableviewcell, for that in uitableview my data is fetch from webservice and i use xmlparsing for that i.e.

-(void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict{
}

-(void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
{
}

-(void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
{
}

Now , If My XML Ouput Return Image Path Name,,

Like hhtp://www.abc.com/a.png

then uitableviewcell can display image ?

If Not Then How I Can Display Imag开发者_如何学Goe...


    NSData *data = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://www.abc.com/a.png"]];
    UIImage *img = [[UIImage alloc] initWithData:data];
    cell.imageView.image = img;
    [img release];
    [data release];


id path = @"http://www.abc.com/a.png";
NSURL *url = [NSURL URLWithString:path];
NSData *data = [NSData dataWithContentsOfURL:url];
UIImage *img = [[UIImage alloc] initWithData:data cache:NO]
cell.imageView.image = img;
0

精彩评论

暂无评论...
验证码 换一张
取 消