将Xcode图像定向到图像视图
您好,快速提问,我正在尝试将我的图像连接到Xcode中的图像视图,当前当我运行程序时,y图像会出现在左上角,但它会出现在左上角,我只是想知道我缺少哪行代码,以便将我的图像直接导航到我的图像视图中 谢谢将Xcode图像定向到图像视图,xcode,image,uiimageview,Xcode,Image,Uiimageview,您好,快速提问,我正在尝试将我的图像连接到Xcode中的图像视图,当前当我运行程序时,y图像会出现在左上角,但它会出现在左上角,我只是想知道我缺少哪行代码,以便将我的图像直接导航到我的图像视图中 谢谢 UIImageView *myImage = [[UIImageView alloc] //Allocating space for the image initWithImage:[UIImage imageNamed:@
UIImageView *myImage = [[UIImageView alloc]
//Allocating space for the image
initWithImage:[UIImage imageNamed:@"TESTPIC.jpg"]];
//Selecting the image
[self.view addSubview:myImage];
//Displaying the Image
可以使用UIImageView的frame属性。请查找以下代码以了解更多信息
UIImageView *myImage = [[UIImageView alloc]
//Allocating space for the image
initWithImage:[UIImage imageNamed:@"test.png"]];
myImage.frame = CGRectMake(your x position, your y position, myImage.frame.size.width, myImage.frame.size.height);
//Selecting the image
[self.view addSubview:myImage];
希望它能起作用