我正在努力编译一款可在iOS 6和iOS 7上使用的iPad应用程序。
这是我不断收到的信息:
Property 'barTintColor' not found on object of type 'UITabBar *'; did you mean 'tintColor'?
目标的Base SDK
设置为Latest iOS (iOS 7.0)
,而是iOS 6.0
。我对项目进行了清理操作。
以下是代码:
在.h文件中:
@property (nonatomic, strong) IBOutlet UITabBar *tabbedBar;
在 .m 文件中:if ([tabbedBar respondsToSelector: @selector(barTintColor)]) {
tabbedBar.barTintColor = [UIColor blackColor];
}
我正在使用iOS 7 SDK编译,所以它应该知道barTintColor。 有什么问题吗?
更新:
好的,我正在取得进展,但还不太明白为什么。
请看这张Xcode屏幕截图。 注意Active Scheme选择中我的iPad 3的两个条目。 有什么区别? 如果我选择顶部选项,就会出现错误。 如果我选择底部选项,就可以正常工作。
是否有人能解释为什么同一设备在此列表中出现两次,以及为什么选择其中一个可以正常工作而选择另一个则不行? FYI,设备安装了iOS 6。
@selector(setBarTintColor:)
吗? - Brian NickelsetBarTintColor
这个方法。请参考这张截图[链接](http://i.imgur.com/kN0Qu7N.png)。 - Axeva@selector()
中,你必须像之前提到的那样输入setBarTintColor:
。 - Tomasz Szulc