简体   繁体   中英

iOS: how to create buttons inside a rectangle?

I do not have much experience on this but I want to position two UIButtons inside a rectangle as in the image below. So what is the best way to do that? I do not want to draw an image of rectangle from Photoshop and import into xCode. Thank you

在此处输入图片说明

You could drag a UIView onto your Storyboard and then drag your buttons onto that, so they are subviews. The storyboard would look like:

view controller
  -view (main)
      -view (your new subview)
           -button1
           -button2

Then you can set the background etc on the subview to visually define the rectangle

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM