我如何一次运行我的代码。也就是说,我有一个您想要始终如一地执行的代码。例子:
- (IBAction)downloadPressed:(id)sender {
//1
CGRect frameDelete = deleteButton.frame;
frameDelete.origin.y = (deleteButton.frame.origin.y-50);
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration: 0.5];
deleteButton.frame = frameDelete;
[UIView commitAnimations];
[progressLine setProgress:0];
//2 Wait until the code is executed above, and then run the code below
NSURL *fileURL = [NSURL URLWithString:@"http://intercreate.ru/all.zip"];
[self downloadDataAtURL:fileURL];
//3 Wait until the code is executed above, and then run the code below
CGRect frameDelete1 = deleteButton.frame;
frameDelete1.origin.y = (deleteButton.frame.origin.y+50);
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration: 0.5];
deleteButton.frame = frameDelete1;
}
也就是说,我想把我的代码分成三部分:
- 首先将旋钮向上移动
- 下载文件
- 后退按钮。
我该怎么做呢?