Live data from Hacker News

Your First iOS App – 100% Programmatically

blog.austinlouden.com

71–80 of 111 posts

Re: Your First iOS App – 100% Programmatically

#71

Earlier quoted context omitted.

> Maybe it's a matter of how you think, but I can "see" the changes when I adjust the frames, colors, padding, resizing masks, and that's basically all IB will do for you. I know what you mean. I'm not an iOS/Cocoa dev by any means, but when I write CSS I typically know what the outcome is going to be in my head because I've done it so many times.

I can see it in both code and interface builder. Doing it in code on iOS is like using CSS where the only selector is `#id` and there are no child selectors. Would you write CSS if you had to do this? #username-label { text-align:right } #first-name-label { text-align:right } ... #last-name-label { text-align:right } #address-label { text-align:right } With CSS, you get nice things like: #user-form label { text-align…

If your iOS code comes out looking that repetitive, sub-optimal code organization is probably the real culprit.

Re: Your First iOS App – 100% Programmatically

#72
post #66

Earlier quoted context omitted.

I jumped into iOS dev after storyboards so, I fear nibs... I've never used one. If I started with a storyboard, should I throw in nibs every now and then for certain tasks??

I like to think of Nibs like classes. A lot of times I'll have a certain design I want reused throughout the app, and this works perfectly. For instance, in an app I'm working on now, I have a few different views that have scroll-views inside of them, with each object of the scroll-view being a view itself. In the last of the chain of views, I use a nib because there's a solid amount of data there, and visually desig…

Keep in mind, this scenario is just as good a candidate (maybe even better) for doing the layout in code rather than a nib.

Re: Your First iOS App – 100% Programmatically

#73
post #27

Earlier quoted context omitted.

I've been a Cocoa developer for close to a decade now, and I've gone back and forth on this many times, but by now I've settled 100% in the nibs-are-evil camps. There are several reasons for that: - Nibs are a nightmare when working with version control and merge tools. Now, at least, they are XML instead of a proprietary binary format, but it's still a joke… - Auto-layout in IB is provably the worst GUI I have ever…

Since you seem to be catching some flak for your post, I'll elaborate a bit further. AutoLayout is a constraint solver, and as such it's very easy to either over-specify or under-specify your constraints in a way where it no longer evaluates. On top of this, AutoLayout also has a priority for each constraint such that if/when such a conflict occurs AutoLayout has some ordering as to which constraints get abandoned fi…

[deleted]

Re: Your First iOS App – 100% Programmatically

#74

Earlier quoted context omitted.

> Maybe it's a matter of how you think, but I can "see" the changes when I adjust the frames, colors, padding, resizing masks, and that's basically all IB will do for you. I know what you mean. I'm not an iOS/Cocoa dev by any means, but when I write CSS I typically know what the outcome is going to be in my head because I've done it so many times.

I can see it in both code and interface builder. Doing it in code on iOS is like using CSS where the only selector is `#id` and there are no child selectors. Would you write CSS if you had to do this? #username-label { text-align:right } #first-name-label { text-align:right } ... #last-name-label { text-align:right } #address-label { text-align:right } With CSS, you get nice things like: #user-form label { text-align…

You could write generator/setter methods for aligning labels to the right, no need for inheritance here. But, smart categories and inheritance go a long way. The last time I tried IB, I really regretted it because I constantly had to click through all those element layers (object hierarchy inspector is not that good either). After about 2h I gave up and rewrote everything to code-only.

Re: Your First iOS App – 100% Programmatically

#75
post #62

Having made a few iOS apps in team/solo environments, I now stick to the following: Large team - don't use Interface Builder. Synchronizing it is too difficult and any productivity gains will be lost. Layout in code is best here, but really is time consuming for complex UIs. However, pixel-perfect match for designers is a great benefit since you're specifying everything in pixels that you can copy right out of the de…

Can you elaborate on why you feel IB and TDD are incompatible? I haven't found it particularly difficult to drive out behavioral tests for views/view controllers powered by NIBs (at least relative to Obj-C TDD in general), since any actions or subview settings you declare in your NIB will be exposed programmatically as well. I'd love to hear about what pain points you have.

Re: Your First iOS App – 100% Programmatically

#76

Earlier quoted context omitted.

Not any of those points is justified, "a nightmare", "the worst". You need to provide something to support all those affirmations.

It's called an opinion. This isn't a peer reviewed paper we're talking about. And his opinion is that merging Nibs is a nightmare. Does he need to document how he did it, when, where, and what the room temp was at the time to "justify" an opinion? Hardly.

>It's called an opinion.

Which are like noses. Everybody has one.

>And his opinion is that merging Nibs is a nightmare. Does he need to document how he did it, when, where, and what the room temp was at the time to "justify" an opinion?

Does he needs to elaborate more in order to justify it?

Of course.

Re: Your First iOS App – 100% Programmatically

#77

Earlier quoted context omitted.

Not any of those points is justified, "a nightmare", "the worst". You need to provide something to support all those affirmations.

Try merging a .nib. You'll see first-hand how hard it is.

Why merge it?

Merging isn't even funny with regular code.

How about having a process for who works on what or when?

Either than or let a single person be responsible for the UI.

Re: Your First iOS App – 100% Programmatically

#78

Earlier quoted context omitted.

> Maybe it's a matter of how you think, but I can "see" the changes when I adjust the frames, colors, padding, resizing masks, and that's basically all IB will do for you. I know what you mean. I'm not an iOS/Cocoa dev by any means, but when I write CSS I typically know what the outcome is going to be in my head because I've done it so many times.

I can see it in both code and interface builder. Doing it in code on iOS is like using CSS where the only selector is `#id` and there are no child selectors. Would you write CSS if you had to do this? #username-label { text-align:right } #first-name-label { text-align:right } ... #last-name-label { text-align:right } #address-label { text-align:right } With CSS, you get nice things like: #user-form label { text-align…

Or you could use a loop :).

    for (UILabel *l in @[self.usernameLabel, self.firstNameLabel, …]) {
        l.textAlignment = UITextAlignmentRight;
        l.textColor = [UIColor redColor];
    }

Re: Your First iOS App – 100% Programmatically

#79

Earlier quoted context omitted.

> Maybe it's a matter of how you think, but I can "see" the changes when I adjust the frames, colors, padding, resizing masks, and that's basically all IB will do for you. I know what you mean. I'm not an iOS/Cocoa dev by any means, but when I write CSS I typically know what the outcome is going to be in my head because I've done it so many times.

I can see it in both code and interface builder. Doing it in code on iOS is like using CSS where the only selector is `#id` and there are no child selectors. Would you write CSS if you had to do this? #username-label { text-align:right } #first-name-label { text-align:right } ... #last-name-label { text-align:right } #address-label { text-align:right } With CSS, you get nice things like: #user-form label { text-align…

What about UIAppearance? You can specify appearance for a UILabel inside a specific container type.

http://nshipster.com/uiappearance/

Re: Your First iOS App – 100% Programmatically

#80
post #36
post #32

Earlier quoted context omitted.

If you say "provably" you really do need to... prove it. What studies are you citing when you say IB auto-layout is "provably the worst GUI?"

He might have meant "probably".

I did :). I wrote the comment on the bus this morning on my iPhone, and the autocorrect failed me! I wish I could still edit it to add a little more substance, though – hard to be thorough on an iPhone screen.
Post reply on HN