本文介绍了设置显示路径/图像的顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 UIView UIImageView 中有几个弧线和矩形。我想在后台拥有 UIImageView 。我已经订购了IB,使图像视图在我的标签和按钮后面。

I have a couple of arcs and rects in a UIView, and a UIImageView as well. I want to have the UIImageView in the background. I have ordered it in IB so that the image view is behind my labels and buttons.

首先,我需要在图像视图中放置一个图像,我不想在IB中做。我试过这个代码

First, I need to put an image in the image view, which I don't want to do in IB. I've tried this code

UIImage *myImage = [UIImage imageNamed:@"image.png"];
UIImageView *myImageView = [[UIImageView alloc] initWithImage:@"myImage"];

但它不工作。

推荐答案

将图片添加到

UIImage *myImage = [UIImage imageNamed:@"image.png"];
UIImageView *myImageView = [[UIImageView alloc] initWithImage:myImage];
[self.view addSubview:myImageView];

这篇关于设置显示路径/图像的顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 14:13