【发布时间】:2013-03-21 12:16:12
【问题描述】:
我有两个导航按钮(左和右)和两个类别按钮(例如 loveCategory 和 otherCategory)。当我选择 loveCategory 时,我希望我的导航按钮仅从 loveCategory 显示(在我的情况下为图像),当我按下 otherCategory 时,导航按钮应该能够仅从 otherCategory 显示(图像)(即当我按下左右按钮时) )。
如果不清楚,请告诉我。
这是我的代码:
-(IBAction)NavigationBtnTapped:(UIButton*)sender {
UIButton *button=sender;
switch (button.tag) {
case 1:
//statements
break;
case 2:
//statements
break;
default:
break;
}
}
-(IBAction)loveCategory {
}
-(IBAction)otherCategory {
}
如何在另一个动作中调用一个动作
-(IBAction)loveCategory
{
-(IBAction)NavigationBtnTapped:(id)sender
{
// Is it possible to call an action within another action?
}
}
【问题讨论】:
-
@chirag - 拼写错误?大声笑
-
我没有得到你的确切信息,请解释更多。
only from loveCategory和only from otherCategory是什么意思。您想为不同的类别使用不同的导航按钮吗? -
可以更详细一点。我在数据库(sqlite)中有 loveCategory 和 otherCategory 的图像。我有两个导航按钮(左和右)。按下loveCategory 后,我使用导航按钮左右移动以显示从DB 获取的图像,但是当我单击otherCategory 并使用相同的左右按钮(位于-(IBAction)NavigationBtnTapped:(UIButton *)sender),我又得到了 loveCategory 的图像,但不是 otherCategory。
标签: ios button uibutton action ibaction