Yet another cocoa without interface builder post

I am sure its been brought up before. I would like to know if its possible to write Cocoa apps without Xcode, Interface Builder, or NIB files in general; another words, write Cocoa programs programmatically using ONLY Objective C. Before you ask me why I would want to do such a thing and that I am crazy, please hear me out.
I come from a Win32 background, and my primary languages are C and C++. I am getting used to Objective C (though I wish I could use C++ to program in Cocoa). I picked up a copy of Cocoa(R) Programming for Mac(R) OS X (3rd Edition) by Aaron Hillegass, and have been trying to learn cocoa from it for the last few months. Basically, I am having big trouble wrapping my mind around cocoa via the very conceptual high level approach this book takes. I can not for the life of me begin to understand this whole making connections with interface builder.
I do NOT plan to write production applications in cocoa by hand, but if I could just write a few trivial applications in cocoa by hand without interface builder or nib files, perhaps when I do use interface builder, I won't have such a hard time understanding whats going on.
Thanks in advance for the help.

__mikem wrote:
I am sure its been brought up before.
I don't care. Your question isn't about learning how to program and learning via the iPhone SDK. I'll do anything I can for you
I would like to know if its possible to write Cocoa apps without Xcode, Interface Builder, or NIB files in general; another words, write Cocoa programs programmatically using ONLY Objective C.
Certainly. You can write command-line Cocoa apps. Xcode is just an IDE like Visual Studio.
Before you ask me why I would want to do such a thing and that I am crazy, please hear me out.
I come from a Win32 background, and my primary languages are C and C++. I am getting used to Objective C (though I wish I could use C++ to program in Cocoa). I picked up a copy of Cocoa(R) Programming for Mac(R) OS X (3rd Edition) by Aaron Hillegass, and have been trying to learn cocoa from it for the last few months. Basically, I am having big trouble wrapping my mind around cocoa via the very conceptual high level approach this book takes. I can not for the life of me begin to understand this whole making connections with interface builder.
You specifically asked to avoid the topic, but I'm sure there are several of us who are really tired of iPhone questions who would be happy to try our hand at explaining the User Interface architecture in Cocoa - if you want to try.
I do NOT plan to write production applications in cocoa by hand, but if I could just write a few trivial applications in cocoa by hand without interface builder or nib files, perhaps when I do use interface builder, I won't have such a hard time understanding whats going on.
You can write Objective-C programs using whatever editor and IDE/makefile you want. You can even work with all the non-UI parts of Cocoa to get a feel of how it works. Technically, you could write code using only Carbon and never use Objective-C, but that is really a dead-end.
A good idea might be start looking at doing writing MacOS X kernel extensions. You should still use Xcode, but only as an IDE. The code would all be C++ (or a subset thereof) with no user interface or NIB files. Realistically, that is probably harder than learning Interface Builder, but it is probably the most productive path available to you for developing MacOS X and avoiding Interface Builder.

Similar Messages

  • Yet ANOTHER Quicktime without sound topic.....

    Sorry to post ANOTHER topic about quicktime without sound, but....
    I have a 1.5ghz powerbook g4, running OSX10.3.9, quicktime 7.1.6, Divx 6.0 codec, and the latest version of Xvid. I've tried my Audio settings at 32000, 44100, and 48000khz, played with audio settings in the quicktime player itself, and I've even reluctantly, as I really prefer QT, tried other players (Mplayer, Windows Media Player, and Divx Player... ). I've tried the garageband solution, and Perian won't work on OSX10.3...
    And yet I still can't play the **** first season of 24 or the new season of Entourage in .avi format...... I recently watched the first three seasons of House, a season of CSI, and Entourage, so why can't I play certain .avi files?

    To Apple Discussions!
    I note that you haven't tried running FSCK and/or VLC Media Player.

  • Yet another Which Audio Interface???

    I apologise for what has probably already been answered, but I want to recycle my Digi002r as a stern anchor for my boat...but I'm afraid I'll still be waiting on some as yet unwritten driver from Digi before it works.
    My shortlist is
    Ensemble,
    Fireface 800,
    Metric Halo 2882.
    I'm hearing glowing words about the sound quality of the Apogee Ensemble.
    recomendations please?
    Keith Moore

    I use MH, I think their interfaces are great - the only thing I do worry about is the Hardware design is a few years old now. In technology, this is getting to be an old design. Beyond that, the only problem I have had with a MH was a manufacturing defect which was acknowledged in a specific run, which they handled very well. They covered everything and I had it back within a few days of contacting them. Before it was fixed, it ran like an 002 - but sounded better. Now it just stays on all the time and does what it should without problems.

  • Yet another Applications/OS X quitting post

    I have read every message on this forum dealing with this problem and tried every suggestion, but nothing yet has work. I've had my MacBook for a week now (And just switched over from a PC. Sucky to be having this trouble right away) and I have already had to get my hard drive reimaged, which was done yesterday. Before Saturday, when it kept crashing during start up, hence the reimaging, it worked perfectly. Since it was reimaged though, my programs and OS X keep shutting down on me. I haven't downloaded anything outside of MSN and Adium, which I got from the Apple website. I have tried resetting the NVRAM and everything else. This problem has been happening with all of my programs, not just what I've downloaded.
    Since I get my laptop through my school, I don't have the Install disk, because they decided we don't need to have them or a paper manual. Is there anything else that can be done, short of going into Tech Services at 7.30am tomorrow, to fix the problem? This is extra frustrating for me since my roommate got her MacBook the same day and has had no problems. I think I've angered the PC gods from switching.

    Yea, I was wondering if it could have just be the computer. It's been behaving itself since I made that post though (as is the case for most problems) and hopefully it'll continue to work. When it works properly I like it though, even though I still need to get used to the differences. (The Dock just isn't the same as Window's toolbar. I miss it.)
    Thanks for the reply.

  • Yet another MPC 1000 L7 Sync post

    i searched through the forum archives and didnt find the sync problem im having with my particular setup. im trying to slave the mpc from logic and have the mpc output signal its coaxial spdif.
    im using a m-audio 410, logic 7 (duh), and the MPC 1k. i have the midi connected (midi out from the 410 to in the MPC) and the spdif out from the MPC to the 410 spdif in. i set my song settings appropriatly in logic, and the sync stuff appropriatly in the MPC.
    now when i hit play in L7, the MPC starts, but the SPL in logic doesnt move at all. and on top of it all, the MPC doesnt read "EXT" like its suppose to in slave mode.
    the odd thing is when i do this same setup with the analog outputs, everything works hunky dory.
    anybody out there have the same problem?

    To be clear, if you pull the spdf out at the interface end does the sync up work? Maybe your interface is seeing the spdf as the master clock or something.

  • IOS develop with or without Interface builder?

    I was always taught to do without the graphical tools, but it is used in all tutorials. I've always written the code necessary for each program. As I am a beginner with developing for iOS, I would like to know if I have to get used to using IB or not.
    thanks to all
    Gabriele

    Thank you very much Michael,
    I really wanted to know this.
    good day.

  • Yet another Superdrive Won't Work Post

    Hello...
    I tried to restart or update the FIRMWARE by starting the computer and going through a process of holding down keys.
    That didn't work.
    I them opened up the eMac and pushed the reset button (PMU or PMI, I think it's called).
    That didn't work.
    I am just wondering what I need to do to fix this because, granted my eMac is 5 years old, but now it won't recognize any DVDs or CDs, and it did before I started all this. Well, it recognized CDs.
    At first the only DVDs it didn't recognize where ones I'd burned from home movies. Now it's all DVDs.
    I am in Mac OS 10.3.9. I have 1 GB of Ram. It's an 800mhz Power PC.
    I am open to any ideas at this point.
    I thank you kindly in advance for reading helping with this.
    Evan Jacobs
    www.anhedeniafilms.com

    First thing to do is run your system through basic maintenance routines. Here is a good page detailing many of the free ones you can download and what they do...
    Macintosh OS X Routine Maintenance
    http://www.macattorney.com/ts.html
    You especially want to run the CRON scripts and repair disk permissions.
    If that doesn't help, next thing you might try is to create a new user account then log onto that one and see if the drive acts any differently. If it works, then the problem isn't the drive, but something with the settings of the other user account.
    Still another test is to whip out your old Restore/Install discs that came with the computer and see if you can boot off of those (hold down the C key while booting). If you can, then you know the drive works at least. If you can't, maybe the drive really is dead.
    Also I ran across this completely crazy fix that there are multiple reports it actually works to get a Superdrive working again...
    * Open system preferences.
    * Go to international
    * Under languages: drag any of the other languages to the top, then drag english back to the top.
    * Make sure "order for sorted lists" is set to enlish
    * Make sure "work break" is set to english(united states, computer)
    * Restart the computer
    Patrick

  • Looking for simple sample of iphone apps without using Interface Builder

    I successfully went through the 'iphone app tutorial' and used Interface Builder, but now want to try creating apps without it.
    The UI Catalog sample is too complex, but didn't see anything that just had a view and a button or label.
    Ideally I want code that doesn't require any IB usage, but I can't tell if that is possible yet...
    Anyone have a link to an easy sample?
    Or has anyone created a test app themselves and wouldn't mind posting?
    I took a stab at creating one and posted it on the "101" forum, but it would be hard for somebody to try and figure out what I was attempting
    Thx for any links/___sbsstatic___/migration-images/migration-img-not-avail.png
    ps
    I really need a good book, especially "cookbook" style

    hey dear
    I have one solution of your problem
    just go to in iphone developer search for FAQ
    In faq their is one section how to use prohramming in this you can see
    the how to ceate label,button etc.
    after that simply add the view or remove theview.

  • After having yet another problem with my MacBook Pro and having to wipe the drive, I am now unable to sync my iPhones etc without erasing all the music on them. Is there a way around this? I have no other library!

    After having yet another problem with my MacBook Pro and having to wipe the drive, I am now unable to sync my iPhones etc without erasing all the music on them. Is there a way around this? I have no other library!
    iTunes is a mess! It couldn't find it's own libraries and I was forced to create a new one. Now I don't know where my music is or if any's missing.

    columbus new boy wrote:
    How crap is that?
    It's not crap at all.
    It's not that simple. For example, I've 3500 songs on my MacBook but don't want them all on my phone, so I have to manually select each song again???
    There has to be a solution.
    Why not simply make a playlist with the songs you want on the iPhone?
    and maintain a current backup of your computer.

  • How do i put tv programmes and videos from itunes to another iphone, without having to delete all data on the phone and replacing it with my library? i switched the 'sync only ticked songs and videos box' yet it still wont let me transfer videos from my i

    How do i put tv programmes and videos from itunes to another iphone, without having to delete all data on the phone and replacing it with my library? i switched the 'sync only ticked songs and videos' yet it still wont let me transfer videos from my itunes onto my new phone, any ideas??

    Copy the entire itunes folder from the old computer to the new computer.

  • How to define interface builder outlets in Cocoa-Python?

    Hi,
    I am writing a Cocoa-Python application but I couldn't find a way to define outlets in Python code that I can use in the Interface Builder. Of course I know how to do that in Objective-C and this doc http://developer.apple.com/documentation/Cocoa/Conceptual/RubyPythonCocoa/Articl es/BuildingRubyCocoaAppl.html explains how to create outlets in Ruby, but what about Python?
    Thanks in advance,
    Ganesh

    I found it out myself. You have to write
    class MyClass(NSObject):
      outletName = objc.IBOutlet('outletName')
      def foo(self):
        # etc.
    Thanks anyway,
    Ganesh

  • Interface Builder - Custom images not visible in Cocoa Simulator

    I'm very new to this, and just toying around with Interface Builder more than anything at this stage…
    Anyway, my problem… I've created some of my own images to place on buttons, etc. I've saved them in PNG format and dragged them into the Resources folder of my Xcode project, so they become available in Interface Builder's media library. I can drag them onto my window just fine, but when I test the UI with the 'Simulate Interface' command, the images disappear completely.
    Any ideas?

    This was changed in Interface Builder 3.0. Now, you have to click on the "Connections" tab in the object's Info panel. I think it is the 2nd one from the right. You will recognize it because you will see all your outlets. You click the little circle next to the outlet and drag a line over the user interface object to make the connection. Once you do that, there is a bug in Interface Builder that will blank out the info panel. You will have to select some other object to redisplay any information, then click back to your original object. The bindings panel has a similar set of bugs. Suffice to say, Interface Builder 3.0 is a work in progress.
    PS - to break a connection, click the little X button next to an outlet name.

  • Organising items in Interface Builder

    I have a number of problems with handling container hierarchies and object groups in Interface Builder.
    1. If I Group a number of items (say a slider and its labels), this does not mean that I can move the entire group as a unit - I still have to Shift-click all the individual items to get them to move. If I Cut a group, then only the subitems I have selected will be Cut, but if I Copy, then the entire group will be copied. This strikes me as somewhat inconsistent.
    2. If I create a Box and create items in it, those items will align with the Box and follow it around if I move the Box. But if I Cut or Copy an item from one Box and then place it in another box, it will not be a subitem of that Box, and will not follow when the Box is moved. I have not been able to find a way to indicate a new parent to a relocated item, is there one?
    3. Sometimes I can drag across a box to select subitems in it, sometimes dragging will instead cause the box to move. I have not been able to discern a clear pattern, does anyone know what the preconditions are for selection one way or the other?
    4. The on-line manual for Interface Builder is rather superficial and does not cover questions such as these, nor do the books on XCode/Objective C that I've looked in. Is there any document or collection of notes that goes into further details on the functions of Interface Builder?
    PowerBook G4   Mac OS X (10.4.7)   Interface Builder 2.5.4

    Hi Kai,
    1. What you mention first is not what I see as far as I can tell - If you have a bunch of controls, drag over to select them all and group them together (⌘G) a dotted line appears and surrounds the group. I cannot move any one member of the group without the whole group moving as well - expected behaviour. However, your observation of cutting and copying seems correct. Perhaps the 'cut' operation should remove the entire group to the clipboard as copy does, leaving the currently witnessed behaviour for the 'delete' key.
    2. Yes. Drag it over the box and let go, then click and hold without moving it and you should notice the shading change a little followed by a green plus icon if you then move it. Drop this now and it'll become a subitem of the box. This also works in reverse.
    3. Click somewhere outside the box to deselect it. Click somewhere in the box - but not on any of the contents - eight selection dots should appear around it. This is the box itself selected and dragging will now move the whole box and contents (again, don't hit any of the items inside when dragging). Click somewhere outside again to deselect it. Now double click somewhere inside it (not on items) and a sort of blue lined box with tick marks on it should appear - this shows that the inside is selected and dragging will select items in it rather than move the whole thing. This can also be observed by directly clicking on one of the items inside (puts you straight inside it).
    4. Not sure, you sort of pick these things up by trial and error and reading posts and such like (very much like some of the more lesser known OS tricks, modifier keys, etc). There may well be a nice collection of tips on the net somewhere but I haven't come across it yet...
    IB seems a little flaky on some of this stuff, especially when repeating actions like putting something into a box, then removing it, then putting it back in, etc. Seems it loses the plot somewhere and you have to dump it and grab another one. Same sort of thing with messing about with matrices - often it starts to misbehave. Hopefully all this sort of thing and what others have complained about from time to time are the result of minimal updates to IB over the last couple of years. Here's looking forward to IB 3!

  • Load Class in Interface Builder 3

    Hello,
    i am trying to get started with Cocoa after having worked a while with Xcode & smaller AppleScript based projects.
    As my idea was to create a menubar-based (NSStatusItem) service app for myself i started with this tutorial:
    http://files.semaja2.net/NSStatusItem%20-%20ObjC.html
    Unfortunaly it seems like there was a change in Interface Builder regarding loading Classes from Version 2 to IB version 3
    The tutorial tells me to (about the middle of the tutorial):
    Rename the “NSMenu1” to “StatusItem”, following this in “Interface Builder” >>choose from the menu “Classes > Read Files..” now select the AppController.h >>file, Once the file has been read it should change out project view to “Classes” >>from here find the AppController item and right click on it and select >>“Instantiate AppController”:
    I was able to follow the tutorial until there without problems but it looks like the Classes-Tab is gone in IB 3.x.
    So i feel somehow unable to finish this small tutorial.
    how would i do this step in Interface Builder 3.x ?
    Any help is heavily appreciated.
    Best regards
    fidel

    fidel-castro wrote:
    I was able to follow the tutorial until there without problems but it looks like the Classes-Tab is gone in IB 3.x.
    So i feel somehow unable to finish this small tutorial.
    how would i do this step in Interface Builder 3.x ?
    You're right, this has changed. I'm currently using IB 3.1.1 but I believe the changes appeared in IB 3.
    Once you've done the "Read class files" and selected your AppController.h file IB should know about your class.
    In order to instantiate your AppController in IB first go to the Library window and find the "NSObject" (it will appear as a blue cube). Drag one of these NSObject's from the Library window and drop it into your MainMenu.xib window along with the other icons that appear there (File's Owner, First Responder, Application... etc).
    Now you will have created an instance of an NSObject in your MainMenu.xib file. And, since your AppController class is a subclass of NSObject (and IB knows this since you've had it read in your AppController.h file) you can now change this NSObject instance into an instance of your AppController.
    Select the NSObject icon in the MainMenu.xib window then go to IB's Inspector window and click on the next to last icon in the top tool bar. This should change the Inspector window's title bar to say "Object Identity" and the Class Identity in the first text field should be set to NSObject. You should be able to type "AppController" into this field (or click the popup and it should show up in the popup list. Once you've done this it will transform the NSObject instance into an AppController instance.
    You'll see another slight difference between IB 3.x and the tutorial when you do the <Control>-Drag between items to connect up the outlets and actions. Instead of finalizing the connections in the Inspector window like the tutorial says you'll get a small popup window right next to the item you're connecting to that will list the available outlets/actions you can connect to. Simply click the one you want. You can still double-check your connections in the inspector window though.
    Steve

  • How to instantiate a control in code instead of using Interface Builder ?

    I really appreciate the combination of the interface builder and Xcode altogether.
    However when I am learning QT, I realize I had been pampered by Apple's Design to a certain extend as I only need to create say a NSLabel instance and use Interface Builder to do the linking and never have to worry about instantiating the Object myself.
    But I'm curious, what is the way to instantiate a new hmmm say...NSLabel in the code ?
    NSLabel* label = new NSLabel();
    Then what ?
    What you are seeing here is how QT did it, could anyone create an equivalent in ObjC ? No fancy code please, just bare minimum.
    #include <QApplication>
    #include <QWidget>
    #include <QLabel>
    int main (int argc, char * argv [ ])
    QApplication app(argc, argv); //NSApplication in ObjC
    //These two lines merely created a window and set the title bar text.
    QWidget* window = new QWidget();
    window->setWindowTitle("Hello World");
    QLabel* label = new QLabel(window);//Create a label and inform the it belongs to window.
    label->setText("Hello World");
    window->show();
    return app.exec();
    Message was edited by: Bracer Jack

    Hi Jack -
    I think my best answer will be something of a disappointment, because I don't know how to show a one-to-one correspondence between the code you're working with and a Cocoa program. The main function of a Cocoa GUI program for OS X will look something like this:
    #import <Cocoa/Cocoa.h>
    int main(int argc, char *argv[])
    return NSApplicationMain(argc, (const char **) argv);
    As you commented, we could draw a correspondence between the first statements, but after that the functionality of the Cocoa program is going to be spread out in a way that makes for a rather tedious comparison. The only way I know to answer your question in less than 5000 words, is to skip ahead to one of several points in the startup sequence where the programmer can intervene with custom code.
    For example, a common way to get control would be to program a custom controller class and add an object of that class to the main nib file which is loaded during the startup sequence. By making a connection to the Application object in that nib file, the custom object could be made the delegate of the Application object, and if we then added a method named applicationDidFinishLaunching, our code would run as soon as the application's run loop was started.
    Now I finally have enough context to directly answer your question, so here is the code to create a label and add it to the key window at launch time:
    // MyAppController.m
    #import "AppController.h"
    @implementation AppController
    - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
    NSLog(@"applicationDidFinishLaunching");
    NSRect frameRect = NSMakeRect(150, 300, 150, 30);
    NSTextField *label = [[NSTextField alloc] initWithFrame:frameRect];
    [label setEditable:NO];
    [label setStringValue:@"Hello World!"];
    [label setFont:[NSFont labelFontOfSize:20]];
    [label setAlignment:NSCenterTextAlignment];
    NSView *contentView = [self.window contentView];
    [contentView addSubview:label];
    @end
    If I needed to develop a worst case scenario for this thread, the next question would be, "Ok sure, but your code still needs a nib to start up. I want to see a Cocoa GUI program that doesn't require any nib".
    It turns out that it's quite easy to build a simple iPhone app without any nib, but it's considerably more difficult for an OS X app. If anyone wants to see my nib-less iPhone code, I'll be happy to post it (I think I did post it here once before, and the response was underwhelming). But I've never attempted the much more difficult nib-less OS X app. Just in case you really want to go there, here's a blog that goes into the details: [http://lapcatsoftware.com/blog/2007/07/10/working-without-a-nib-part-5-open-re cent-menu>.
    Hope some of the above is helpful!
    - Ray

Maybe you are looking for

  • Two event handler

    I am using two event handler     CLASS-METHODS:         handle_data_changed_finished             FOR EVENT data_changed_finished OF cl_gui_alv_grid                 IMPORTING e_modified                           et_good_cells.     CLASS-METHODS: catch

  • XML Report Page Layout Problem

    Dear Members, We are working on 11i Version of Oracle Apps. Recently I developed an XML Report which has two pages. I want Page-1 in Landscape style and Page-2 in Portrait Style. I've prepared the RTF template in Landscape and on Page-2 I have select

  • Which Function Should i use for static values for a an array[] in BPM 11g.

    Hi Experts, Please throw some light on this.. I've a requirement which is bugging me.. How do i assign a static value to a array in BPM11g in script activity. What exactly function do i need to use to assign a Static value for an Array [] I been doin

  • Installation option from Ovti to 5800 ?

    I wanted to download a calculator from Ovti and install it on my 5800 memory card .   The link was sent to my phone and after being connected I said Yes to download and install .    I never got the option as to where to install .   I usally get this

  • Can't access all shared systems with 10.7.4

    A few days ago we added a few new iMacs running 10.7.4 (currently). We set up all our network shares to various servers using SMB, with an edited hosts file in /etc. For the first few days, we were able to connect without an issue. Today however, our