我想通过用户 ID 从特定用户的 php 文件(例如:http://abc.xyz.com/api/showImage.php)获取图像,并在我的 iOS 应用程序的 ImageView 中设置图像。我该怎么做? 提前致谢。
最佳答案
你可以从上面的 URL 中以 NSData 的形式获取图片:
NSData *imageData = [NSData dataWithContentsOfURL:[NSURL urlWithString:@"http://abc.xyz.com/api/showImage.php"]];
UIImageView *imageView = [UIImageView alloc] initWithImage:[UIImage imageWithData:imageData]];
关于iphone - 从 php 文件获取图像到 iOS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15612820/