Hacker Newsnew | comments | show | ask | jobs | submitlogin

I find the mechanism of connecting UI elements to outlets by dragging around to be gimicky and pointless.

Why can't the runtime auto-bind them by matching names? Doesn't ruby work this way?

The whole point of having the action/outlet system is that it provides a layer of indirection and lets you write less code. There's no need to write an event handler for a button to make it print a view. You just drag an action from your NSButton to your view, and set its selector to print:. The same goes for outlets.

I'm not sure what you mean by "auto-binding by matching names". The only way I could see that working, is if you gave the control and the target names, then inputted the action as (control name, target name, action). IMO this would be a lot more work than the current UI.




I'm not sure what you mean by "auto-binding by matching names". The only way I could see that working, is if you gave the control and the target names, then inputted the action as (control name, target name, action). IMO this would be a lot more work than the current UI.

Well, I was referring more to linking IBOutlets as opposed to IBActions.

I think Visual Studio's way is superior - ie, from the UI Designer, you can autogenerate and link the action for a button as well as having the option to link an existing action.

-----


Well, I was referring more to linking IBOutlets as opposed to IBActions.

You still have the problem of selecting the object owns the outlet. You may want to connect a text field to an outlet on a view nested down a few levels. You'd have to give both the text field and the view names, which again takes time and effort.

I think Visual Studio's way is superior - ie, from the UI Designer, you can autogenerate and link the action for a button as well as having the option to link an existing action.

I haven't used VS for quite a while. IIRC there is always a user class associated with the UI. This is not the case in Cocoa. It's common for file's owner to be, say, a plain NSWindowController, and there to be no user classes in the nib at all.

It's tempting to think of an "action" in Cocoa as being synonymous with a method. But this isn't the case. When you click a button, it doesn't directly call it's action on its target. The actual process is more complex, and provides a lot of room changing where the action message is sent. This is what makes insane magic that is first responders work.

-----


Alright, I'm sold. I never really considered any if those circumstances. I'm still feeling my way around.

-----




Applications are open for YC Summer 2015

Guidelines | FAQ | Support | Lists | Bookmarklet | DMCA | Y Combinator | Apply | Contact

Search: