Iphone 如何在UIView中添加带有坐标的图像?

Iphone 如何在UIView中添加带有坐标的图像?,iphone,objective-c,ios,uiimageview,Iphone,Objective C,Ios,Uiimageview,是否可以在UIView中添加具有特定坐标的图像? 如果是这样的话,有没有人热衷于解释如何做这样的事情 UIImageView *myImage = [[UIImageView alloc] initWithImage:someImage]; myImage.frame = CGRectMake(40, 40, myImage.frame.size.width, myImage.frame.size.height); [myView addSubview:myImage]; 这将在特定坐标处添加

是否可以在UIView中添加具有特定坐标的图像? 如果是这样的话,有没有人热衷于解释如何做这样的事情

UIImageView *myImage = [[UIImageView alloc] initWithImage:someImage];
myImage.frame = CGRectMake(40, 40, myImage.frame.size.width, myImage.frame.size.height);
[myView addSubview:myImage];
这将在特定坐标处添加一个包含在图像视图中的图像。

类似的内容

UIImageView *myImage = [[UIImageView alloc] initWithImage:someImage];
myImage.frame = CGRectMake(40, 40, myImage.frame.size.width, myImage.frame.size.height);
[myView addSubview:myImage];

这将在特定坐标处添加包含在图像视图中的图像。

您需要创建UIImageView并将其帧设置为所需坐标

UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:<#imageName#>]];
imageView.frame = CGRectMake(<#x#>, <#y#>, <#width#>, <#height#>);
  [yourViewController.view addSubView:imageView];
UIImageView*imageView=[[UIImageView alloc]initWithImage:[uiImageName:];
imageView.frame=CGRectMake(,,);
[yourViewController.view添加子视图:imageView];

让我知道这是否适合您。

您需要创建UIImageView并将其帧设置为所需的坐标

UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:<#imageName#>]];
imageView.frame = CGRectMake(<#x#>, <#y#>, <#width#>, <#height#>);
  [yourViewController.view addSubView:imageView];
UIImageView*imageView=[[UIImageView alloc]initWithImage:[uiImageName:];
imageView.frame=CGRectMake(,,);
[yourViewController.view添加子视图:imageView];

让我知道这是否适合您。

是的,您必须在
-(void)drawRect:(CGRect)aRect中绘制图像,通过子类化
UIView
,或添加
UIImageView
作为主视图的子视图,显示图像

看看这些:

.

是的,您必须在
-(void)drawRect:(CGRect)aRect中绘制图像,通过子类化
UIView
,或添加
UIImageView
作为主视图的子视图,显示图像

看看这些:

.

在询问此类问题之前,您应该正确地搜索周围。在询问此类问题之前,您应该正确地搜索周围。如果说“infoViewController可能没有响应-addSubView:”:(您需要编写
[infoViewController.view addSubView:imageView]
。我想显示具有4个坐标的图像,这意味着左侧高度和右侧高度不同。如果显示“infoViewController可能不响应-addSubView:”,则如何更改此HMMMMM:(您需要编写
[infoViewController.view addSubView:imageView]
。我想显示具有4个坐标的图像,这意味着左侧高度和右侧高度不同。那么如何对此进行更改