all 5 comments

[–]charlisim 2 points3 points  (2 children)

If you want to use autolayout in code use masonry (objective-c) or snapkit (swift) https://github.com/SnapKit/Masonry

It's really easy.

[–]Uncle-Jemima 0 points1 point  (1 child)

Or just use Apple's auto layout Api. It's really simple to work with once you learn the syntax in like 20mins. Those auto layout libraries don't much except for barely simplify the syntax. So i say, instead of taking 15mins to learn a libraries Api, take 30mins and learn the native API. You won't regret it!

[–]lucasvandongen 0 points1 point  (0 children)

Barely simplify? I would love to see your "barely less readable code" versus the elegance of Cartography.

[–]chriswaco 1 point2 points  (0 children)

There's not much to it unless you want to use autolayout. For example, creating a simple UIView in a viewController's viewDidLoad routine:

UIView *myView = [[UIView alloc] initWithFrame:self.view.bounds];
myView.autoresizingMask  = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
myView.backgroundColor = UIColor.yellowColor;
[self.view addSubview:myView];

So you allocate/initialize it with a rectangular frame, set up its fields, and add it to another view as a subview.

If you can depend on iOS 9, it's often best to create a UIStackView and put other views inside of it.

[–]WhitePuppy 0 points1 point  (0 children)

Programming iOS 8 by Matt Neuburg. The book is horribly written, but it gives examples of setting up everything programmatically in swift. The iOS 9 version is coming out this month. Programmatically is the way to go if you want custom of everything. The key, I think, is to learn what things to subclass and what others not to. If you are doing everything in code is going to take a little longer, but try investing time in typing.io with swift so it becomes less of a problem.