简体   繁体   中英

Swift Align Leading Edge with Trailing Edge

I have a label that I want as the x axis label on my graph, and I want to align the trailing edge of the label to the graph view, and also the top edge to the bottom edge of the graph view, how can I do this? I am building it via storyboard

storyboard screenshot with constraints 在此处输入图像描述

I record my screen to get what you want:

https://giphy.com/gifs/JbnR5F1ZFogb7gSojT/fullscreen (Sorry for the gif-quality)

Just keep pressing control and drag your mouse from the UILabel to the graph view to do the same thing.

  1. Add horizontal spacing
  2. Add bottom constraint
  3. Select the bottom constraint by clicking the blue line that represents it
  4. Change relation to first item (your label) from Bottom to Top value

If I misunderstood what you want and you wanted the following:

在此处输入图像描述

Just select the horizontal spacing constraint by selecting the blue line that represents it, and adjust the constraint's settings with the following:

在此处输入图像描述

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