Interface/design object c xcode

Discussion in 'Mac Programming' started by danewithoutwax, Dec 28, 2010.

  1. danewithoutwax macrumors newbie

    Joined:
    Aug 19, 2010
    #1
    I'm still pretty new to programming and object c. I got all my code written now, but how do i create a interface/design for the app? I know how easy it is to do when creating iPhone apps, but i can't seem to figure out how to do it with normal applications?
     
  2. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #2
    Same way as do for the iPhone apart from the fact that Mac OS X interfaces tend to be much more complex than iPhone interfaces and can (and most likely should) span several XIB files.

    Just open up Interface Builder and have at it. Then hook up the interface objects with your code.
     
  3. danewithoutwax thread starter macrumors newbie

    Joined:
    Aug 19, 2010
    #3
    How do i hook it up?
     
  4. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #4
    It is pretty much exactly the same as the iPhone.
     
  5. danewithoutwax, Dec 28, 2010
    Last edited: Dec 28, 2010

    danewithoutwax thread starter macrumors newbie

    Joined:
    Aug 19, 2010
    #5
    I've only seen someone work with the iphone build interface, i've never actually tried it, so i'm sorry, but i don't know what you mean by that.

    I have created my desired interface.
     
  6. marktronics macrumors newbie

    Joined:
    Oct 18, 2010
    #6
    Might not cover everything, but let's take a stab at it.

    You're going to want to create a view controller for your interface winder that is a subclass of UIViewController ( MyFirstViewController : UIViewController).

    Then in Interface Builder hit Cmd+0 to bring up the Document Window. Click on File's Owner, then press CMD+shift+i to get the info window to come up. Hit the rightmost tab and set the identity of the File's Owner to the view controller class you just created.

    Now, go back to your h file for your class and create ivars for every outlet you need. For example:

    IBOutlet UILabel *myLabel;
    IBOutlet UISlider *mySlider;

    If you go back to Interface Builder and right click on File's Owner, you should see outlets now for these new vars. Drag from the outlets to the actual UI elements.

    Good luck!
     
  7. marktronics macrumors newbie

    Joined:
    Oct 18, 2010
    #7
    Also worthwhile - try looking up a tutorial on how to do this and take your time to go through it. :)

    This one seems helpful:

    http://icodeblog.com/2008/07/30/iph...connecting-code-to-an-interface-builder-view/
     
  8. PatrickCocoa macrumors 6502a

    Joined:
    Dec 2, 2008
    #8
    Hooking Up

    Hooking up (as the kids say) will take you some time to get your head around. You'll need to spend a few hours/days going through some tutorials on how Xcode, Objective-C, and Cocoa view code and the user interface.

    It's not as simple the old days, where you'd just put a statement in the code like CreateWindow(100, 150, 75, 75); and when that line was executed the window would be created. Now you create the window in Interface Builder, then "hook it up" to your code using the IBOutlet processor commands.
     
  9. marktronics macrumors newbie

    Joined:
    Oct 18, 2010
    #9
    Agreed! It took me a while to get enough of Interface Builder figured out to be comfortable using it, but it gets the job done now fine.

    It is nice to not have to create everything programmatically though! :)
     

Share This Page