ios - UIImage 是否具有 myLabel.hidden = YES 的等价物?

标签 ios uiimage uilabel

我想用方法中的代码隐藏 UIImage ... 然后在其位置显示其他内容,然后再次重新启用它。我该怎么做?

我知道如何使用 UILabels (myLabel.hidden = YES) 来做到这一点,但不知道如何使用 UIImage

谢谢!

最佳答案

确保您的 UIImage 包含在 UIImageView 中:

UIImage *theImage = [UIImage imageNamed:@"someImageName.png"];
UIImageView *imgView = [[UIImageView alloc] initWithImage:theImage];

self.imageView = imgView; // assuming you have a property called imageView

[imgView release];

[self.view addSubview:self.imageView]; //in your view controller

完成此操作后,您可以使用:

[self.imageView setHidden:YES];

关于ios - UIImage 是否具有 myLabel.hidden = YES 的等价物?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4384143/

相关文章:

iOS:本地化的 UILabel 文本未对齐

objective-c - 在一行UITable中设置多个UILabel

iOS 自动布局中心屏幕中的 3 个 block

ios - 调试通知扩展

ios - UIImage 作为模式

ios - 尝试从资源库 URL 获取 UIImage

ios - 如何将数组的数组放入 Swift 1.2 中的另一个数组

ios - 使用 task_for_pid() 越狱开发者 iPhone

ios - 通过 UIImage 或 PHImageManager 调整图像大小

ios - 动态高度uilabel