Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Halfmaster1

macrumors newbie
Original poster
Dec 28, 2010
19
0
Hello, I have Xcode, and a tutorial for C. I think that I understand the basics of C pretty well, but I have no idea how to use GUI, as the tutorial said nothing about it, and I can only use printf() to see what is happening in my program. Is there any tutorials that you guys know of on how to use GUI?
 
Clarify

Are you asking about how to use Xcode, or are you asking about how to write programs that have GUI elements (windows, text fields, buttons, etc.)?

If you're asking about how to write programs that have GUI elements, you'll need to move from C to Objective-C, and you'll need to use the Cocoa APIs.

Objective-C is needed as that's what Apple requires to access Cocoa. Cocoa is required as that's what Apple requires to access their GUI elements (as well as Apple's implementation of arrays, dictionaries, and other elements).

My advice is to find a tutorial on Objective-C and Cocoa. You will NOT be able to use C to create anything Mac-like on the screen. For instance, you will not be able to use C to write a line like "createWindow(x, y, width, height, title)". All of that is done in Objective-C by calling the Cocoa method that creates windows.
 
Sorry if I didn't make my OP clear, I meant the GUI, yes. And sorry for the slow reply.


So, no GUI at all in C. Well, that is disappointing. I'll look in my Objective-C tutorial, which I have, but didn't look at yet because I thought I should make something in C first.

Or should I try C++. Is that like C? Because Objective-C is like a completely different language.
 
C++ is not what you want

For native Macintosh and iOS application development, there is only Objective-C and Cocoa / Cocoa Touch.

It sounds like you have a certain background and would like to use your existing skills to develop for the Mac / iPhone / iPad. Unfortunately that will not be possible. You can use your prior experience and understanding of computers to give you a slight head start on a complete newcomer, but you will need to forget much of what you know about how to do things.

For native Macintosh and iOS application development, there is only Objective-C and Cocoa / Cocoa Touch.

There may be a few posts after this telling you about Java or Ruby or C++ or some other things. Feel free to look into them, but if it were me I wouldn't spend too much time on them.
 
For native Macintosh and iOS application development, there is only Objective-C and Cocoa / Cocoa Touch.

It sounds like you have a certain background and would like to use your existing skills to develop for the Mac / iPhone / iPad. Unfortunately that will not be possible. You can use your prior experience and understanding of computers to give you a slight head start on a complete newcomer, but you will need to forget much of what you know about how to do things.

For native Macintosh and iOS application development, there is only Objective-C and Cocoa / Cocoa Touch.

There may be a few posts after this telling you about Java or Ruby or C++ or some other things. Feel free to look into them, but if it were me I wouldn't spend too much time on them.

That's not true at all. You can use Carbon to code any GUI you want, and of course there are a lot of libraries written in C. C++ is also fine, as well as Java.
 
So, no GUI at all in C.

Well, it's because C is an old language that is designed to be portable. You write your code on a Mac, say, and the same program will run on a DOS PC or a graphing calculator. Programs written to use the console (printf etc) will run on pretty much anything.

When you start writing code for GUIs then you're starting to specialize. Windows GUI programming is different from Mac GUI programming, which is different from programming for X/Motif or Qt (both of which will run on either platform), and you're no longer strictly talking about the C programming language so much as whatever enhancements or libraries are required to support the particular GUI you choose.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.