我有一个 UIImageView,它使用 URL 显示图像,我有一个下载按钮,它会打开一个 UIActionSheet,然后使用 URL 下载文件我想知道如何使用 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”的字符串中。