【发布时间】:2014-10-09 05:50:18
【问题描述】:
我遇到了一个问题,我正在开发一个测验应用程序,这里我使用一个按钮的返回目的。在我的应用程序中,第一个问题我隐藏了返回按钮,遵循以下代码。
if ((questionIndex=1))
{
backbutton.alpha=0;
}
在这个应用程序中,我使用代码来回答下一个问题,
if (questionIndex < totalQuestionsCount - 1) {
[self loadQuestionsWithIndex:questionIndex + 1];
questionIndex++;
}
回到问题,
if (questionIndex > totalQuestionsCount - 1) {
[self loadQuestionsWithIndex:questionIndex + 1];
questionIndex--;
}
转到下一个问题后,显示返回按钮,但是当我想再次返回第一个问题时,我需要隐藏返回按钮,但这里显示。 这很简单,但我很困惑如何解决它,请您建议我。谢谢。
【问题讨论】:
-
为什么不使用
button.hidden = YES或button.enabled = NO -
您是否为每个新问题都设置索引 +1?然后,您可以将每次后退按钮单击设为 -1。你能提供更多的代码吗?
-
这里一切正常,但是当我遇到第一个问题时,我需要隐藏按钮。
-
button.hidden=YES 和 button.enabled=NO 不适用于 @Bhumit
标签: ios iphone if-statement uibutton