-(void)method1
{
[self method2];
[self method3]; //After finishing execution of method2 and its delegates I want to execute method3
}
在这里,method2 在调用时开始运行,但在执行其委托方法之前,method3 开始执行。如何避免这种情况?请有任何建议或代码
我在方法 2中调用了一个 nsurl 连接及其代表
-(void)method2
{
....
connection= [[NSURLConnection alloc] initWithRequest:req delegate:self ];
....
}
-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
}
-(void) connection:(NSURLConnection *) connection didReceiveData:(NSData *) data
{
}
..
..