【问题标题】:How to access button image name?如何访问按钮图像名称?
【发布时间】:2017-11-24 09:22:33
【问题描述】:

我正在尝试访问我的按钮图像名称并使用 if 检查其值,然后为该按钮设置另一个图像

【问题讨论】:

标签: ios objective-c image uibutton


【解决方案1】:

试试这个代码,

   if (btn1.currentImage == [UIImage imageNamed:@"currentIcon.png"] ) 
    {

    }
    else
    {
    [btn1 setImage:[UIImage imageNamed:@"newIcon.png"] forState: UIControlStateNormal];
    }

【讨论】:

    猜你喜欢
    • 2014-10-20
    • 2015-06-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多