界面跳转后mapkit的delegate获取不到

ST_francais 2015-11-28 12:15:40
大家好,我一个与地图相关的app,需要进行界面的传值,下面是代码:
界面一:
class HomeViewController: UIViewController, MKMapViewDelegate {
func JumpToSearchViewBtn () {
HomeVIew.removeFromSuperview()
// let MainStoryboard = UIStoryboard(name: "Main", bundle: NSBundle.mainBundle())
// Jump2SearchView.SelectedCity = CitySelectBtn.titleForState(UIControlState.Normal)!
// let Jump2SearchView = MainStoryboard.instantiateViewControllerWithIdentifier("SearchView")
// Jump2SearchView

let Jump2SearchView = SearchViewController()

self.presentViewController(Jump2SearchView, animated: true, completion: nil)
}
下面是didload里面一些代码 应该没问题,因为用注释掉的方法写的没有bug
}

界面二:
import UIKit
import MapKit


class SearchViewController: UIViewController {

@IBOutlet weak var SearchUserView: MKMapView!

var SelectedCity:String = ""

override func viewDidAppear(animated: Bool) {

SearchUserView.delegate = self
}
多余的代码就不写了
这个方法能传值,但是运行到delegate这里就报错
fatal error: unexpectedly found nil while unwrapping an Optional value
关于mapview的好像都有问题.....
不知道是什么原因,请大神指点
...全文
103 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
ST_francais 2015-11-28
  • 打赏
  • 举报
回复
好吧 有事自己绕过去了。。。手动用代码创建mapview就没问题了。。。但是为什么我用控件啦的就不行呢

29,030

社区成员

发帖
与我相关
我的任务
社区描述
主要讨论与iOS相关的软件和技术
社区管理员
  • iOS
  • 大熊猫侯佩
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧