Live data from Hacker News

Your First iOS App – 100% Programmatically

blog.austinlouden.com

81–90 of 111 posts

Re: Your First iOS App – 100% Programmatically

#81
post #27

So, a word of advice to new folks trying out iOS land: Interface Builder is most emphatically your friend. The compile/debug cycle in iOS is sufficiently lengthy that laying out views programmatically gets very tedious very fast. Besides realtime previewing of exactly how your view is going to look , IB also helps you understand how your layout is affected by rotations to landscape and differences in view height betw…

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…

It's hard for me to believe that Storyboards or AutoLayout were designed by someone that actually builds non-trivial apps for a living. They're the kind of technologies that look good in a one-hour conference demo but quickly fall apart in real world use. After nearly throwing my laptop across the room on my latest project I ripped AutoLayout out of my project entirely and went back to springs & struts + frame math.

What this means though is that a layout I can build in five minutes in Android with takes hours in iOS and is utterly opaque to version control. This is a cost I have to pass on to my clients.

Re: Your First iOS App – 100% Programmatically

#82
post #30

This article, although still great for beginners to get started, is using dated techniques that should be avoided. In the past, developers would have resorted to starting with interface builder to do their designs. As they continued the development process, theyd notice that more and more of their views had to be done in code because Interface Builder wasn't powerful enough to do what they wanted. It could then be un…

I seriously doubt you've made a complex app if you're recommending Auto Layout.

Re: Your First iOS App – 100% Programmatically

#83
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…

It's hard for me to believe that Storyboards or AutoLayout were designed by someone that actually builds non-trivial apps for a living. They're the kind of technologies that look good in a one-hour conference demo but quickly fall apart in real world use. After nearly throwing my laptop across the room on my latest project I ripped AutoLayout out of my project entirely and went back to springs & struts + frame math.…

You need to learn AutoLayout putting the blame on it won't help you.

Re: Your First iOS App – 100% Programmatically

#84
post #83

Earlier quoted context omitted.

It's hard for me to believe that Storyboards or AutoLayout were designed by someone that actually builds non-trivial apps for a living. They're the kind of technologies that look good in a one-hour conference demo but quickly fall apart in real world use. After nearly throwing my laptop across the room on my latest project I ripped AutoLayout out of my project entirely and went back to springs & struts + frame math.…

You need to learn AutoLayout putting the blame on it won't help you.

I understand it. The problem is that not only is it a fundamentally flawed concept but the tools are inadequate. Moving a control by as much as one pixel in IB can completely scramble your constraints, including deleting user constraints attached to properties.

The API is ridiculously verbose and the visual language is underpowered and cryptic. It's sad but going back to manual frame calculations actually saved me a lot of time.

I think a lot of iOS devs don't realize how crap it is because they haven't taken the time to learn how other platforms solve these problems in a much more logical & developer friendly way.

Re: Your First iOS App – 100% Programmatically

#85
post #78

Earlier quoted context omitted.

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]; }

Or use a helper class (called Design.m/.h) with a call:

  +(void)styleLabelForCertainPage:(UILabel *)label {
       label.textAlignment = UITextAlignmentRight;
       label.textColor = [UIColor redColor];
  }
Then run those through your loops. If you're seriously considering writing a lot of lines for something trivial, then you're probably doing it wrong in Objective-C.

Re: Your First iOS App – 100% Programmatically

#86
post #34
post #4

I made a fake account to ask this question b/c I'm too ashamed not to know this: Is there an equivalent Visual Basic-style editor for making iOS apps? You just place the button, double click on it, add functionality, drop in elements and you're off the races? Just looking at this tutorial, it is astonishing how much knowledge you need to have to get up & running and create something so simple like a HelloWorld exampl…

Having used both, the answer is actually no. People will say that Interface Builder is the equivalent and to some degree that's true - you use both to drag/drop UI elements on the page. However, the main feature I think you are looking for from VB (and any Visual Studio language for that matter) is the ability to double-click on a something like a Button control and have it create a new click event all wired up ready…

This is still fairly trivial stuff, and I like the IDE a ton better in Xcode than Visual Studio (seriously, I shouldn't have to stop my current build just to add lines in VS - that's lame). Just open up your dual screen editor, put the xib on the left or right, then your header on the other side. Right-click down on an element (hold it!) then drag over to the header. It'll set everything up you need to add your event actions in the header and implementation files, as well as the getter/setter methods.

Re: Your First iOS App – 100% Programmatically

#87
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.

Please do a write up on how you use TDD with ObjC/VCs. I'm sure that others would be interested as well.

Re: Your First iOS App – 100% Programmatically

#88
post #79

Earlier quoted context omitted.

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/

I love UIAppearance. I am not too well versed in CSS but UIAppearance adds a lot of what I have seen done with CSS. You can change the default appearance of most default elements really easily, and declare containers inside of that with a whole different set of defaults. It makes styling your app a really painless process. All you have to do to make all the UIToolbars in your app red, for example, is use this one line at the start of your program.

  [[UIToolbar appearance] setTintColor:[UIColor redColor]];

Re: Your First iOS App – 100% Programmatically

#89
post #30

This article, although still great for beginners to get started, is using dated techniques that should be avoided. In the past, developers would have resorted to starting with interface builder to do their designs. As they continued the development process, theyd notice that more and more of their views had to be done in code because Interface Builder wasn't powerful enough to do what they wanted. It could then be un…

I seriously doubt you've made a complex app if you're recommending Auto Layout.

I hear this over and over again but don't understand why "complex" suddenly means "non-idiomatic UX." Most iOS apps follow common design patterns, and IB makes building these patterns extremely straightforward. For the one-off odd screens, sure, don't use IB, but certainly if you are building an iOS app the majority of screens will not require crazy unique UX. If they do that is probably a design smell.

Re: Your First iOS App – 100% Programmatically

#90
post #51
post #46

Earlier quoted context omitted.

Also a fun fact: Stanford University in their CS 193p classes teaches how to utilize Storyboards. And Auto Layout. And everything else that Apple provides for the devs.

There is a huge difference between academia and real world products shipped by teams w/real world experience w/academic backgrounds. Stanford academic guidelines endorsed and supported by Apple, Inc. I wonder what approach Evan Doll uses at Flipboard...hmmm?

While I have no idea why M4v3R made that comment, as it's utterly irrelevant what Stanford teaches in their iPhone app class, it's also evident that you don't even know what M4v3R is referencing. He's referring to a class Stanford teaches on making iPhone apps, which has nothing to do with any sort of academic guidelines. The professor chose to use Storyboards, and that's that.
Post reply on HN