【发布时间】:2014-09-18 10:46:22
【问题描述】:
好的,所以我的 CoreLocation 东西在我的 AppDelegate 中启动并运行,并且有一些使用它的方法。 现在,我想从我的 ViewController 调用 AppDelegate 中的这些方法之一。但是,此方法所需的参数 [即location stuff],我的 ViewController 不知道。 我现在应该在我的 ViewController 中设置整个 CoreLocation hoopla,还是有更简单、更智能、更优雅的方法? (我很害怕这个问题表明我有点怀念编程的基础知识,但我愿意自欺欺人) 谢谢打扰...
示例:在我的 AppDelegate 中,有一个方法叫做
-(void) sendDataToServer:(CLLocation *)newLocation
它需要一个位置作为输入。 CoreLocation 在 AppDelegate 中初始化,因此位置参数在 APpDelegate 中是已知的。但不在 ViewController 中。
【问题讨论】:
标签: ios methods parameters appdelegate