ios - How to programatically adjust x and y axis of image in Swift? -


I am trying to focus the image of my screen in the middle of my screen. (I have a video that plays it down). I can not get it in the center on screen size. I'm sure this is a simple solution, but if someone has any ideas then I would be very grateful

Here is the image of my simulator:

And here is my code:

  imageViewObject = UIImageView (frame: CGRactMake (Self.view.frame), 150, 150, 150) imageViewObject.image = UIImage (named: "one.png") self.view.addSubview (imageViewObject)  

Thanks in advance for any help! The problem is that the situation is in the original top left corner, you should use something instead:

  imageViewObject = UIImageView (frame: CGRKMake (self.view.frame) - 150/2, 150, 150, 150))  
< / Html>

Comments