更新到Swift4后,出现编译错误:静态成员“appearance”不能用于协议(protocol)元类型“UIAppearance.Protocol”这是我的自定义TabBarController子类中的viewWillAppear方法,我正在设置项目文本的字体。overridefuncviewWillAppear(_animated:Bool){super.viewWillAppear(animated)//compilererroronlinebelowUIAppearance.appearance().setTitleTextAttributes([NSAttributedSt
更新到Swift4后,出现编译错误:静态成员“appearance”不能用于协议(protocol)元类型“UIAppearance.Protocol”这是我的自定义TabBarController子类中的viewWillAppear方法,我正在设置项目文本的字体。overridefuncviewWillAppear(_animated:Bool){super.viewWillAppear(animated)//compilererroronlinebelowUIAppearance.appearance().setTitleTextAttributes([NSAttributedSt
我目前正在编织一个复杂的UIAppearance修饰符*,并且遇到了一个问题。我对FlatUIKit的自定义UIBarButton外观协议(protocol)的使用导致MFMailComposerViewController提示并停止工作。因此,不是使用UIAppearance的whenContainedIn方法来指定导致修改发生的类,有没有办法排除某些类,即“当不包含在“?*我说的是UIAppearance协议(protocol),它用于在应用的委托(delegate)中预定义对象外观设置。 最佳答案 您可以使用appearanc
我正在使用UIAppearance自定义导航栏、选项卡栏和uibarbuttonitem等元素。除了UIBarButtonItem元素的非常奇怪的行为外,它工作得很好。在导航Controller层次结构的顶层,一切看起来都不错,但如果我按下下一个ViewController,UIBarButtonItem元素会稍微向下移动一点,但与此同时,后退按钮会保持在正确的位置。我附上了两张图片来说明我的问题。1)导航Controller层次结构中的第一个ViewController2)导航Controller层次结构中的第二个ViewController编辑:代码//Changenavigati
我的应用程序中有许多UILabel元素,我正在寻找一种简单的方法来使用UIAppearance代理对象来设置它们的样式。我目前的方法是创建配备UI_APPEARANCE_SELECTOR装饰器的UILabel的不同子类,以便可以通过[UILabelSubclassappearance]调用访问。您可以找到我用作引用的来源here和here.问题是我不想设置字体大小,而只想设置依赖于Storyboard中定义的大小的字体系列。如何在子类中设置它? 最佳答案 这是一个使用UIAppearance代理的简单类别:@interfaceUIL
我使用UIAppearance为我的UINavigationBar设置bartint颜色,除了弹出窗口中的导航栏,这工作正常,我在这里遗漏了什么吗?以下行在应用程序didFinishLaunchingWithOptions[[UINavigationBarappearanceWhenContainedIn:[UIPopoverControllerclass],nil]setBarTintColor:[UIColorredColor]]; 最佳答案 UIImage*navBarImage=[[UIImageimagewithcolor
我正在使用这段代码[[UIButtonappearance]setBackgroundImage:[UIImageimageNamed:@"button.png"]forState:UIControlStateNormal];改变UIButton的外观。这很好地工作并且不影响UIBarButtonItem除了其中一个(唯一一个不是自动生成的“后退”按钮)并且仅在最初。当您触摸条形按钮时,它会恢复为没有背景图像。有问题的按钮是UIBarButton而不是UIButton(除非两者都是,在这种情况下其他UIBarButton应该受到影响也是)。一个线索可能是其他未受影响的UIBarButt
我为一些UI类设置了自定义外观。[[UIBarButtonItemappearance]setTintColor:someColor];...[[UINavigationBarappearance]setBackgroundImage:someImageforBarMetrics:UIBarMetricsDefault];因此,当我在我的应用程序中创建UIBarButtonItem的或UINavigationBar的对象时,它们将具有已定义的外观。但是如果想让一些对象有标准的外观(不使用代理定义的),我需要手动将它的所有属性设置为默认值。所以问题是:有什么方法可以阻止对某些对象使用UI
因此,我使用外观API对所有View进行样式设置。F.e.我使用以下方式设置我的UINavigationBar样式:[[UINavigationBarappearance]setBackgroundImage:navigationBarBgImageforBarMetrics:UIBarMetricsDefault];我想利用外观api的优势,将我所有的UINavigationBar都放在一个地方(因为我有多个),所以我不想只做一些子类化因为造型原因。我还会弹出一些MFMessageComposeViewController和一个SLComposeViewController以发布到i
我正在使用UIAppearance设计我的UINavigationBar样式.我希望所有后退按钮都具有灰色文本,并且我所有的rightBarButtonItems都具有绿色文本(颜色是假设的)。由于默认情况下这两个按钮都是UIBarButtonItems,因此UIAppearance将无法区分两者。所以我决定继承一个UIBarButtonItem,称它为ActionBarButtonItem。我在任何需要rightBarButtonItem的地方使用这个新的子类。rightBarButtonItemUIBarButtonItem*done=[[ActionBarButtonItemal