gpt4 book ai didi

iphone - 按下按钮时更改导航按钮项目

转载 作者:行者123 更新时间:2023-12-03 20:51:39 26 4
gpt4 key购买 nike

我希望能够将右侧导航栏按钮更改为具有名称和操作的不同按钮。

举个例子:

btnOpenImage 被按下,rightNavButton1 更改为 rightNavButton2

最佳答案

    -(IBAction) btnOpenImage_Clicked:(id)sender{

//1. IF buttons are UIBarButtonItem then use bellow code
// This bellow line for Change the action(Target)
[rightNavButton1 setAction:@selector(rightNavButton2_Clicked)];

//This bellow line For Change the Title
[rightNavButton1 setTitle:@"rightNavButton2_Clicked"];

//OR 2. IF buttons are UIButton then use bellow code

// This bellow line for Change the action(Target)
[rightNavButton1 addTarget:self action:@selector(rightNavButton2_Clicked) forControlEvents:UIControlEventTouchUpInside];

//This bellow line For Change the Title
[rightNavButton1 setTitle: @"rightNavButton2" forState: UIControlStateNormal];
}

关于iphone - 按下按钮时更改导航按钮项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13813797/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com