我有一个使用URL显示图像的UIImageView,我有一个下载按钮,可以调出一个UIActionSheet,然后使用URL下载文件,我想知道如何编码下载它的一部分使用NSURLConnection。使用NSURLConnection下载
- (IBAction)DownloadClick:(id)sender {
UIActionSheet *Action = [[UIActionSheet alloc]
initWithTitle:@"Options"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"Download", nil];
[Action showInView:self.view];
}
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 0) { //The Download code will go here This is where i need ur help
}
Url被保存在名为“Url”的字符串中。
你尝试过什么下载代码? – Wain 2013-04-24 07:57:58
我尝试了ASIHTTPRequest方法,但从github项目文件 – Vishal 2013-04-24 07:59:53
Google'AFNetworking'或'NSURLConnection示例'中导入类时遇到了很多问题。 – Wain 2013-04-24 08:02:22