我有一个 feed,我想显示图像,如果用户没有图像,它会在 json 中显示 null。如果用户确实有图像,则将使用图像 url 设置该图像。
我想删除它,这样它就不会占用表格视图单元格中的空间。
我的代码是:
if imageStringFromJson == nil {
//how do i remove the imageview? <-- need help here
} else {
//set image from url in imageview
}
Run Code Online (Sandbox Code Playgroud) 我有一个UIWebView,我只是显示一些文字.我正在使用html文本格式化UIWebView.我怎么能在image/UIImage里面加一个呢?我需要显示一个固定帧的图像.
我不提供代码,因为这纯粹是一个概念性的“如何实现这个”问题。但我在下面列出了我的尝试和限制。
我尝试了几种不同的策略来实现这一目标。基本上,我有可变宽度的图像,并且希望图像在左侧完美对齐,并与右侧的标签保持 8px 间距。请看下面的图片!
视图本身位于垂直 UIStackView 内。这一行是一个水平的 UIStackView,但我也用一个简单的 UIView 容器尝试过。唯一的约束设置在 UIImageView 上,固定高度为 20px。但我正在寻找任何可行的策略来实现可变宽度、一致的边距行为。
我尝试将 UIImageView 上的 compressionResistence/contentHuggingPriority 设置为低,以及两者之间的每个组合。这是不可能的吗?
我突出显示了蓝色背景来演示该问题
如上所示,蓝色图像视图为 20 x 40 点,内容模式设置为宽高比适合。
如何使图像视图宽度增大或缩小以匹配图像的纵横比?
我正在使用if语句UIImageView根据变量的值设置图像.这是声明:
- (void)configureView
{
if (self.detailItem) {
if ([detailItem isEqualToNumber:[NSNumber numberWithInt:0]]) {
[mapImageView setImage:[UIImage imageNamed:@"0.jpg"]];
NSLog(@"derp");
}
}
}
Run Code Online (Sandbox Code Playgroud)
"derp"被打印但是UIImageView图像不会改变......如果我把setImage:声明放进去就行了viewDidLoad.我做错了什么?
我想在我的iOS应用程序中旋转我的imageView 360度
(当我的标签文字是"你好")
请帮我
if ([myLabel.text isEqualToString:@"hello"] == YES)
{
//here i want the imageView to rotate
}
Run Code Online (Sandbox Code Playgroud) 我正在使用这个项目 IOS-Image-Swiper
我试图在视图中设置图像但没有成功.
self.photos = [[NSMutableArray alloc] initWithObjects:
[UIImage imageNamed:@"green.png"],
[UIImage imageNamed:@"green.png"],
[UIImage imageNamed:@"green.png"],
nil];
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助.
海IAM新的objective c和iOS发展
设置UIImageview图像.尝试以下代码
arrowImgVw is UIImageView Class object
UIImage *image=[[UIImage alloc]init];
image=[UIImage imageNamed:@"return_journey_denoter.png"];
arrowImgVw.image = image;
Run Code Online (Sandbox Code Playgroud) uiimageview ×7
ios ×6
objective-c ×2
animation ×1
cocoa-touch ×1
github ×1
iphone ×1
swift ×1
swift2 ×1
uiimage ×1
uikit ×1
uiwebview ×1