extra argument 'error' in call
反正我是没看懂错误信息
查了百度看了半天发现:
出现这句话一定是代码有问题,不是swift语法问题,就是传递的参数问题
因为OC写习惯了,而在swift中,基本都是参数在前面,方法在后面
eg:
self.navigationBar.titleTextAttributes = [NSFontAttributeName: UIFont.systemFontOfSize(18.0),NSForegroundColorAttributeName:UIColor.whiteColor()]
而之前的写法一直写成了
self.navigationBar.titleTextAttributes = [UIFont.systemFontOfSize(18.0),NSFontAttributeName,:UIColor.whiteColor,NSForegroundColorAttributeName()]// 错误写法
还有就是
func changeNavigationItem(viewController:UIViewController) {
viewController.navigationItem.leftBarButtonItem = UIBarButtonItem(image: UIImage(named: "back_arrow_white" as String), style: UIBarButtonItemStyle.Plain, target: self, action:#selector(RMNavigationController.back))
}
开始的时候我在action:直接接的back()和@"back",系统开始错误指向style后面提示警告.
总之,出现这个错误后,仔细查下代码就好了
swift刚开始学习,慢慢体会吧,发现挺有意思,但有的时候也感觉会有点不习惯....