我有 3 种方法,我希望所有这些方法都一个一个地完成。
它可能是使用块完成的,但我无法学习如何创建自己的块。或者有没有其他方法可以实现这一目标?
我的情况是,
同样没有块的场景在 ios6 中运行良好,但低于该值的操作系统无法正常工作
[self getIndex];
[self expandrows]; //I want this expandrows to be called only after everything in getIndex is finished.
-(void)getIndex
{
[self didSelectRowAtIndexPath:indexPath];
//Once this didselect is completed execution than after only i want to start this loop
for (int index = 0; index < [tableView numberOfRowsInSection:0]; index++)
{
NSMutableDictionary *aMutDicCur = [self.model itemForRowAtIndexPath:[NSIndexPath indexPathForRow:index inSection:0]];
if([[aMutDicCur valueForKey:@"CategoryId"] intValue] == 4)
{
indexPath = [NSIndexPath indexPathForRow:index inSection:0];
break;
}
}
//After this loop finishes i need to again call one other method
}
据我所知,块是异步的。所以在这种情况下