2015-10-11 78 views
0

嗨目前真正的問題我試圖將我的圖像連接到Xcode中的圖像視圖,當前運行程序時y圖像出現,但它在左上角顯示,I只是想知道我錯過了哪些代碼行,以便將我的圖像直接導航到我的一個圖像視圖。將Xcode圖像導入圖像視圖

感謝

UIImageView *myImage = [[UIImageView alloc] 
    //Allocating space for the image 

          initWithImage:[UIImage imageNamed:@"TESTPIC.jpg"]]; 

    //Selecting the image 

              [self.view addSubview:myImage]; 

    //Displaying the Image 

回答

0

可以使用的UIImageView的框架屬性。請查找以下代碼以獲取更多信息。

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]; 

希望它有效。