Ios 使用外观代理仅定位顶部导航栏的栏按钮
我正在使用外观代理来设计我的应用程序,但我对[uibarbuttonite外观]有问题;我只想设置顶部UINavigationbar按钮的样式,但是当我运行下面的代码时,同样的样式也会应用于键盘的done按钮Ios 使用外观代理仅定位顶部导航栏的栏按钮,ios,objective-c,uibarbuttonitem,Ios,Objective C,Uibarbuttonitem,我正在使用外观代理来设计我的应用程序,但我对[uibarbuttonite外观]有问题;我只想设置顶部UINavigationbar按钮的样式,但是当我运行下面的代码时,同样的样式也会应用于键盘的done按钮 NSDictionary *btnAttributes = [NSDictionary dictionaryWithObjectsAndKeys: [UIColor blackColor],
NSDictionary *btnAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
[UIColor blackColor],
UITextAttributeTextColor,
[UIColor clearColor],
UITextAttributeTextShadowColor, nil];
[[UIBarButtonItem appearance] setTitleTextAttributes: btnAttributes
forState: UIControlStateNormal];
因此,我的问题是:是否可以使用外观代理仅为顶部导航栏的栏按钮设置样式?您可以将外观限制为某些容器类。从: 返回给定容器中接收器的外观代理 等级制度(必选)
在使用诸如
MPMoviePlayerController
之类的类时要小心,因为该beast实际上使用了UINavigationController
的子类,但与外观不兼容。不管怎样,很高兴我能帮上忙。
appearanceWhenContainedIn:
+ (id)appearanceWhenContainedIn:(Class <UIAppearanceContainer>)ContainerClass,...
[[UIBarButtonItem appearanceWhenContainedIn:[UINavigationController class], nil]
setTitleTextAttributes:btnAttributes
forState:UIControlStateNormal];