Tag: uibarbuttonitem

alignmentUIBarButtonItem后退button

这是我在我的viewDidLoad方法: self.navigationController?.navigationBar.backIndicatorImage = UIImage(named: "back")?.imageWithRenderingMode(.AlwaysOriginal) self.navigationController?.navigationBar.backIndicatorTransitionMaskImage = UIImage(named: "back")?.imageWithRenderingMode(.AlwaysOriginal) self.navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: UIBarButtonItemStyle.Plain, target: nil, action: nil) 这显示了一个自定义的图片,当点击button时工作,但是该button被推向状态栏。 如何降低button?

如何以编程方式删除UIBarButtonItem发光?

不幸的是,没有showsTouchWhenHighlighted为UIBarButtonItem,我不能从工具栏编辑我的button… 任何帮助,高度赞赏! 🙂 谢谢, 尼莉

button操作没有响应iphone

当我按下nextButton,这是UIBarButton。 然后关联的动作不执行。 UIButton *nextButton1=[UIButton buttonWithType:UIButtonTypeCustom]; [nextButton1 setBackgroundImage:[UIImage imageNamed:@"next.png"] forState:UIControlStateNormal]; [nextButton1 addTarget:self action:@selector(goToItems) forControlEvents:UIControlEventTouchUpOutside]; [nextButton1 sizeToFit]; UIBarButtonItem *nextButton=[[UIBarButtonItem alloc]initWithCustomView:nextButton1]; self.navigationItem.rightBarButtonItem=nextButton;

如何在运行时“干净地”更改UIBarButtonItem文本(编辑 – >完成 – >编辑)?

我试图在运行期间“干净地”更改UIBarButtonItem文本,以便编辑/完成模式可以切换。 每次我在运行时改变title属性,animation看起来都很笨拙。 我正在模拟“通讯录”应用程序中的“编辑/完成”button的外观和function(其中“编辑”只是淡入淡出,“完成”处于显示位置)。 @IBAction func editDoneButtonPressed(sender: UIBarButtonItem) { if(sender.title == "Edit"){ sender.title = "Done" }else{ sender.title = "Edit" } } 初始设置:标识符设置为“自定义”,标题设置为“编辑” 更简单的编程解决scheme是首选,然而,animation的外观确实是最重要的。 我会考虑切换UIBarButtonItem标识符,而不是它的文本属性,但是,我不确定在运行时切换标识符的优雅方式。 顺便说一句:我正在使用Swift来构build应用程序。 链接到… 截屏的通讯录应用程序编辑/完成切换animation: https : //youtu.be/5mT_vzpNhIw 我的编辑/完成切换animation的截屏: https : //youtu.be/mEweotJNVNE 谢谢。

从UIBarButtonItem的新视图?

所以我看过以前的类似问题,但是没有任何帮助。 我也读过苹果的文档,但是我不明白我出错的地方。 AFAIK我做了所有的逻辑,但是当我点击一个UItoolbar覆盖层上的完成button,button可以推动,但它什么都不做。 这显然意味着它不能确认书面的代码。 但是,如何? 当我在UIToolBar上单击完成button时,我想调出“TableViewController”的.nib。 但是下面是不允许点击来提出一个新的观点。 我如何纠正这一点? 请告诉我我错在哪里,应该更换什么,为什么。 -(void)doneButtonPressed { TableViewController *UIView = [[TableViewController alloc] initWithNibName:@"TableViewController" bundle:nil]; UIView.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; [self presentModalViewController:UIView animated:YES]; [UIView release]; }

在Swift4中,更换navigationItem.leftBarButtonItem将调整不需要的大小

UIBarButtonItem在使用帧和图像的不同值返回到VC时resize时遇到​​问题。 var selectedR = 1 var leftFrame = CGRect() var leftImage = UIImage() override func viewDidLoad() { super.viewDidLoad() if selectedR == 0 { leftFrame = CGRect(x: 0, y: 0, width: 33, height: 33) leftImage = UIImage(named: “pic-0”)! } else if selectedR == 1 { leftFrame = CGRect(x: 0, y: 0, width: 79, height: 33) leftImage […]

如何以编程方式禁用/启用UIBarButtonItem

我目前有一个名为continueButton的button,它已被分配到一个Storyboard文件中的UIBarButtonItembutton。 我已经宣布这样的button: – (IBAction)continueButton; 当视图加载的时候,我想让button自己禁用,这样就不会有用户input,除非一个命令被调用,重新启用button的用户input。 我怎么去做这个? 我试图使用函数[continueButton setEnabled:YES]; 以编程方式禁用/启用button,但不能正常工作。

UIBarbuttonItem更改textColor

我有一个工具栏中的这两个button,并希望改变UIBarButtons的颜色,我怎么能做这样的事情? 我试过setTitleTextAttributes,但它似乎并不像它有一个对象? 我怎样才能做到这一点 UIBarButtonItem *sysDoneButton = [self createButtonWithType:UIBarButtonSystemItemDone target:self action:@selector(actionPickerDone:)]; UIBarButtonItem *sysCancelButton = [self createButtonWithType:UIBarButtonSystemItemCancel target:self action:@selector(actionPickerCancel:)];

UITableView setEditing为NO不会改变barButtonItem回来

我有一个UITableViewController里面的UINavigationController 。 我正在设置rightBarButtonItem到编辑button: self.navigationItem.rightBarButtonItem = self.editButtonItem; 这工作很好,并在我调用tableView:commitEditingStyle:forRowAtIndexPath:我编程更改我的tableView出编辑模式使用: [self.tableView setEditing:NO animated:YES]; 这里的奇怪的事情是, barButtonItem似乎仍然处于“编辑模式”,因为它仍然表示“完成”,就像我处于编辑模式时一样。 点击它将button更改回“编辑”,然后我必须点击“重新join”才能重新进入编辑模式。 为什么不是barButtonItem从编辑模式改变?

设置UIBarButtonItem不改变标题,只改变样式

我有一个UIBarButtonItem在右上angular说'编辑'。 点击后,这个代码被称为 – 我知道这是因为该button是底气。 但是,button的标题不会更改。 这是我的代码: // set to not editing and change buttons [self setEditing:YES animated:YES]; UIBarButtonItem *doneButton = (UIBarButtonItem *)sender; [doneButton setTitle:@"Done"]; [doneButton setStyle:UIBarButtonItemStyleDone]; self.navigationItem.rightBarButtonItem = doneButton; 编辑2: 下面的代码是做我想做的,但是第一次点击编辑button,没有任何反应。 -(void)editButton:(id)sender { self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Edit" style: UIBarButtonItemStylePlain target:self action:@selector(edit:)]; } -(void) edit:(UIBarButtonItem *) barBtnItem { // if not editing if (![self isEditing]) […]