草庐IT

uiBarButtonItem

全部标签

ios - UIBarButtonItem 标题偏移量

我试图在UIBarButtonItem标题中使用unicode符号,但更改标签大小会使其在垂直方向上过高,而且明显偏离中心。当前使用的代码:letfontDict=[NSFontAttributeName:UIFont.systemFontOfSize(30.0)]editButton.title="✎"editButton.setTitleTextAttributes(fontDict,forState:UIControlState.Normal)我试过添加一个偏移量,但它似乎没有做任何事情。editButton.setTitlePositionAdjustment(UIOffset

swift - 如何在 UIBarButtonItem 上使用信息按钮?

如何在UIBarButtonItem上使用信息灯?我不想使用自定义图像,因为结果不是很好。我想使用Swift在UIBarButtonItem上使用Apple“信息”按钮。 最佳答案 没有直接的方法可以使用UIBarButtonItemAPIs创建这样一个条形按钮.虽然您可以使用配置有.InfoLightUIButton的自定义View,但建议here://CreatetheinfobuttonletinfoButton=UIButton(type:.infoLight)//Youwillneedtoconfigurethetarge

swift - 如何在 UIBarButtonItem 上使用信息按钮?

如何在UIBarButtonItem上使用信息灯?我不想使用自定义图像,因为结果不是很好。我想使用Swift在UIBarButtonItem上使用Apple“信息”按钮。 最佳答案 没有直接的方法可以使用UIBarButtonItemAPIs创建这样一个条形按钮.虽然您可以使用配置有.InfoLightUIButton的自定义View,但建议here://CreatetheinfobuttonletinfoButton=UIButton(type:.infoLight)//Youwillneedtoconfigurethetarge

ios - 如何以编程方式在 Swift 中创建 "Back"UIBarButton 项目?

我能够创建一个可以使用以下代码以编程方式返回的UIBarButton项目:funcbackAction()->Void{self.navigationController?.popViewControllerAnimated(true)}overridefuncviewDidLoad(){super.viewDidLoad()letbackButton=UIBarButtonItem(title:"Back",style:UIBarButtonItemStyle.Plain,target:self,action:"backAction")self.navigationItem.left

ios - 如何以编程方式在 Swift 中创建 "Back"UIBarButton 项目?

我能够创建一个可以使用以下代码以编程方式返回的UIBarButton项目:funcbackAction()->Void{self.navigationController?.popViewControllerAnimated(true)}overridefuncviewDidLoad(){super.viewDidLoad()letbackButton=UIBarButtonItem(title:"Back",style:UIBarButtonItemStyle.Plain,target:self,action:"backAction")self.navigationItem.left

ios - 在文本属性字典中实例化 UIFont 时出错

我正在尝试像这样设置UIBarButtonItem的字体:letbarButton=UIBarButtonItem.appearance()barButton.setTitleTextAttributes([NSFontAttributeName:UIFont(name:"AvenirNext",size:15],forState:UIControlState.Normal)但是它会抛出一个编译器错误:Cannotinvoke'init'withanargumentlisttype'($T7,forState:UIControlState)`我不知道那是什么意思。我也试过了barBut

ios - 在文本属性字典中实例化 UIFont 时出错

我正在尝试像这样设置UIBarButtonItem的字体:letbarButton=UIBarButtonItem.appearance()barButton.setTitleTextAttributes([NSFontAttributeName:UIFont(name:"AvenirNext",size:15],forState:UIControlState.Normal)但是它会抛出一个编译器错误:Cannotinvoke'init'withanargumentlisttype'($T7,forState:UIControlState)`我不知道那是什么意思。我也试过了barBut

ios - ActionSheet 源 View BarButtonItem

我在导航栏中有一个栏按钮项,当按下它时,将显示一个UIAlertController,其样式为.ActionSheet。在iPhone中,它以我想要的方式出现。对于iPad我知道我需要添加//ForiPad,setthepopoverboundsvarpopOver=optionMenu.popoverPresentationControllerpopOver?.sourceView=buttonasUIViewpopOver?.sourceRect=(buttonasUIView).boundspopOver?.permittedArrowDirections=UIPopoverAr

ios - ActionSheet 源 View BarButtonItem

我在导航栏中有一个栏按钮项,当按下它时,将显示一个UIAlertController,其样式为.ActionSheet。在iPhone中,它以我想要的方式出现。对于iPad我知道我需要添加//ForiPad,setthepopoverboundsvarpopOver=optionMenu.popoverPresentationControllerpopOver?.sourceView=buttonasUIViewpopOver?.sourceRect=(buttonasUIView).boundspopOver?.permittedArrowDirections=UIPopoverAr

ios - 快速以编程方式将按钮添加到工具栏

我很难快速将按钮添加到工具栏,下面你可以看到我想要的工具栏图像,不幸的是,即使我在Storyboard文件中设计了它,它也没有在将工具栏设置为可见时显示。我设计它的方式是两个项目,第一个是flexablespace元素,第二个是add元素。它看起来像这样:这是我用来尝试在代码中复制它的代码:self.navigationController?.toolbarHidden=falseself.navigationController?.toolbarItems=[UIBarButtonItem]()self.navigationController?.toolbarItems?.appe