ios - Programatically create subview that covers the top 50% of the iphone screen -


I have a subview and I am changing it to size using the property of the frame and it's the parameters of the CGTKK function Values ​​.

I am slowly but definitely changing the CGRectMake parameter and turning the app back on to get a subview for the correct position on the screen, but I know that there should be an easy way .

What I'm currently doing:

  UIImageView * halfView = [[UIImageView alloc] initWithImage: image]; [Self.view addSubview: halfView]; HalfView.frame = CGRectMake (0, 0, 320, 270); Is there no way that I can stop manually recording those 4 parameters in CGRTK, and just set it to the top 50% of the screen?  

What do I want here to see the subview should be seen on the iPhone screen:

Enter image details here

Thanks for the help.

  halfView.frame = CGRactack (0, 0, 320, self.view.boundsskies. High / 2);  

You just take the height and divide it by two

You might see 320 to self.view.bounds Should be changed .isize.width

I really suggest reading this post to get an understanding of UIViews and work with them:


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -