2011. 11. 23. 15:23

[Xcode] 서버에서 이미지 불러오는 방법

-(UIImage *)loadImageWithFromURL:(NSString *)url {
    NSMutableURLRequest *requestWithBodyParams =
                                             [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]];
    NSData *imageData =
                 [NSURLConnection sendSynchronousRequest:requestWithBodyParams returningResponse:nil error:nil];
    return [UIImage imageWithData:imageData];
}

사용예)
UIImage *image = [loadImageWithFromURL:@"동영상 주소"];

Trackback 0 Comment 0