如何检查iphone应用程序中是否已经隐藏了任何值
我在iPhone应用程序中有两个按钮,我希望如果button1被隐藏,当我们创建PDF时,我们可以检查button1是否已经隐藏,然后不再隐藏它,在生成PDF时也不会显示它,因为在创建PDF时,我隐藏了一些按钮。您可以编写如下内容如何检查iphone应用程序中是否已经隐藏了任何值,iphone,ios,uibutton,Iphone,Ios,Uibutton,我在iPhone应用程序中有两个按钮,我希望如果button1被隐藏,当我们创建PDF时,我们可以检查button1是否已经隐藏,然后不再隐藏它,在生成PDF时也不会显示它,因为在创建PDF时,我隐藏了一些按钮。您可以编写如下内容 if(button1.hidden){ //here button1 is hidden , so you can write code accordingly... }else{ //here button1 is not hidden , so you can
if(button1.hidden){
//here button1 is hidden , so you can write code accordingly...
}else{
//here button1 is not hidden , so you can write code accordingly...
}
快乐编码 只需使用按钮上的.hidden属性即可 隐藏按钮(如果尚未隐藏)
if(!yourButton.hidden) //Button is not hidden
{
//hide button
yourButton.hidden = YES;
//do other magic here if required
}
要更改按钮的可见性,可以使用
yourButton.hidden = YES; //Set button hidden, (YES or NO, NO is by default)
您可以使用其
ishiden
属性检查UIButton
是否隐藏,也可以使用其setHidden:
方法隐藏该UIButton
使用以下逻辑及其方法
if ([button1 isHidden]) {
//Generate your PDF here because if Button is hide then this condition true and load this code
}
else{
[button1 setHidden:YES];//we hide that button here and after load your code here
}
使用一个包含您感兴趣的条件的
BOOL
实例变量。这是否打破了MVC模式?您正在使用[V]视图来保存状态,该状态属于[M]模型。