objective-c – iOS:在创建字典时尝试从对象[1]插入nil对象
发布时间:2020-12-16 06:44:24 所属栏目:百科 来源:网络整理
导读:我正在创建一个自定义导航栏类??,并使用以下代码自定义它的标题属性: self.titleTextAttributes = @{ UITextAttributeFont: bariol,UITextAttributeTextColor: [UIColor whiteColor] }; 但是,当我运行代码时,它会返回以下错误消息: *** Terminating app du
我正在创建一个自定义导航栏类??,并使用以下代码自定义它的标题属性:
self.titleTextAttributes = @{ UITextAttributeFont: bariol,UITextAttributeTextColor: [UIColor whiteColor] }; 但是,当我运行代码时,它会返回以下错误消息: *** Terminating app due to uncaught exception 'NSInvalidArgumentException',reason: '*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[1]' 我正在使用Xcode 4.6并在使用iOS 6的设备上运行. 解决方法
文字的参数(字典的值和键)不能为零.
如果你喜欢不那么严格的构造函数,你可以考虑使用[NSDictionary dictionaryWithObjectsAndKeys:]. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容