Jathu Satkunarajah

Jathu Satkunarajah

Torunto Joined over 9 years ago

  • 5 stories
  • 8 comments
  • 2 upvotes
  • Posted to Hard time adapting to using Xcode, Dec 27, 2017

    I would suggest not using storyboards. Storyboard is not as flexible as doing everything programmatically and it doesn't scale well when you have many people working on one project. Use NSLayoutConstraints and do everything programmatically.

    Here is a small example where I:

    1. Set the width to 50% of some other view
    2. Set the height to some fixed constant
    3. Set the view to be horizontally center of the parent view, with a 10 pixel offset
    4. Set the y position to start at the top of the parent
    NSLayoutConstraint.activate([ view.widthAnchor.constraint(equalTo: otherView.widthAnchor, multiplier: 0.5), view.heightAnchor.constraint(equalToConstant: 100), view.centerXAnchor.constraint(equalTo: parent.centerXAnchor, constant: -10), view.topAnchor.constraint(equalTo: parent.topAnchor) ])

    Sorry about the formatting. But as you can see, I have total control of how my view is laid out. This should definitely be more familiar to someone with web front end experience (in fact iOS gives you more control IMO).

    For a tutorial, a quick YouTube search gave me this: https://www.youtube.com/watch?v=3Xv1mJvwXok

    4 points
  • Posted to Show DN: Post your desktops, in reply to Chris Wright , Jul 21, 2015

    wow this color is surprisingly beautiful as a wallpaper

    screenshot

    1 point
  • Posted to The hardest parts of computer science - Developer Tea Ep. 8, Jan 19, 2015
    3 points
Load more comments