Forum Xamarin.iOS

How to center a Logo on LaunchScreen Storyboard

DennisAbrahamDennisAbraham USMember ✭✭
edited May 2015 in Xamarin.iOS

I am new to mobile development - I have a LaunchScreen Storyboard and have a logo. How do I center the logo for all screen resolutions? Any link to help me out? Thanks in advance.

Best Answer

Answers

  • DennisAbrahamDennisAbraham USMember ✭✭

    Thanks @KMullins!

    Even with that link it was not straight forward but I will recap what I did after going through the link. (Just incase if it would help someone else)

    Environment: Xamarin on Mac.

    1. Created a new storyboard for LaunchScreen.
    2. Added this storyboard to the info.plist
    3. Opened storyboard and created a View Controller
    4. Added a Image View with a Logo (60x60)
    5. Added 2 simple constraints by dragging the edge in X and Y direction.
    6. Once this constraint is added - click on the image and go to layout on properties.
    7. Select the first constraint and use edit
    8. Select Center X on the Second Image
      9 Add half of you width of logo to constraints (in my case 30)
      Repeat for Y steps 8 and 9.

    To test - just view as different sizes instead of generic and see if it centers.

  • darrell.tunnelldarrell.tunnell USMember ✭✭

    @DennisAbraham - thank you for this.

    I'm stuck on step 5 - adding the 2 constaints.. When I create these (by dragging the right hand edge to the right, and the top edge upwards) - resizing the view in the designer just leaves the image in place - it doesn't get centered. I am really not understanding this constraint milarky so far.. Could you perhaps provide more detail perhaps there is something I am missing?

  • darrell.tunnelldarrell.tunnell USMember ✭✭

    Aha - nevermind - I found everything I needed to understand about constraints here: https://developer.xamarin.com/guides/ios/user_interface/designer/designer_auto_layout/

    It turned out I wasn't actually creating the constraints, as I wasn't dragging the handle to the drop areas!

Sign In or Register to comment.