我想将 15 个 UIButtons 添加到 IBOutletCollection 并分别更改每个 UIButton 的标签。我可以为每个按钮分配一个标签,然后以某种方式更改与按钮标签相关的按钮标签吗?或者他们需要单独的 socket 让我更改单独的按钮标签?
Best Answer-推荐答案 strong>
在按钮单击方法中编写此代码。设置 tag 并检查条件并设置
特定标签 的title
-(IBAction)btnClickid)sender{
UIButton * btn = (UIButton *)sender;
int btag = btn.tag;
if(btag == 1)
[btn setTitle"Your Title " forState:UIControlStateNormal];
else if (btag == 2)
[btn setTitle"Your Title " forState:UIControlStateNormal];
}
关于ios - 将按钮 socket 添加到 IBoutletCollection Xcode,我们在Stack Overflow上找到一个类似的问题:
https://stackoverflow.com/questions/25074899/
|