# Doubts in setting up constraints for Y axis for a subview

**URL:** <https://forums.kodeco.com/t/doubts-in-setting-up-constraints-for-y-axis-for-a-subview/206000>\
**Category:** Auto Layout by Tutorials\
**Tags:** ios\
**Created:** [August 21, 2024, 8:23am UTC](https://forums.kodeco.com/t/doubts-in-setting-up-constraints-for-y-axis-for-a-subview/206000 "2024-08-21T08:23:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![darkcavalier11](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@darkcavalier11](https://forums.kodeco.com/u/darkcavalier11)\
**Post date:** [August 21, 2024, 8:23am UTC](https://forums.kodeco.com/t/doubts-in-setting-up-constraints-for-y-axis-for-a-subview/206000/1 "2024-08-21T08:23:04Z")

</div>

On the end of chapter 4, the challenge ask to code a view and center it on the screen. While i was able to build the view, not able to properly center it on the Y-axis. I saw the challenge solution, but it has the same issue as well. Here i added a screenshot for the result. It seems the view is bit down of the Y-center coordinate

 ![Simulator Screenshot - iPhone 15 Pro - 2024-08-21 at 13.51.27](https://files.chunter.kodeco.com/original/3X/d/0/d0910dadd81effacbb1c9dc4ad9fa761373c660c.png)

Here is the github url

> **[alt-materials/04-construct-auto-layout-code/projects/challenge/MessagingApp at...](https://github.com/kodecocodes/alt-materials/tree/editions/1.0/04-construct-auto-layout-code/projects/challenge/MessagingApp)**
>
> The projects and materials that accompany the Auto Layout by Tutorials book - kodecocodes/alt-materials

---

<div class="post-metadata">

**Author:** ![chrisjl](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/chrisjl/32/110937_2.png) [@chrisjl](https://forums.kodeco.com/u/chrisjl)\
**Post date:** [August 25, 2024, 1:09pm UTC](https://forums.kodeco.com/t/doubts-in-setting-up-constraints-for-y-axis-for-a-subview/206000/2 "2024-08-25T13:09:34Z")

</div>

For this one, I would say don’t worry about it and move on. The tableview has additional height behind the navigation elements that are contributing to where “centre” is. The approach being used (adding a subview directly to the table view) is probably discouraged by Apple, and definitely doesn’t scale well. For example If you had enough contacts to fill your screen 2.5 times over, tapping the “i” for rows near the start or end of the list would result in `contactPreviewView` being out of view. As soon as you had enough contacts for scrolling to be required, `contactPreviewView` would become further and further off centre.
