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

Sean7512

macrumors 6502a
Original poster
Jun 8, 2005
856
41
Hello all!

With the spurred interest from non-programmers and from programmers new to the Obj-C/Cocoa scene, I thought that we could use this thread as a single-stop shop for questions and help. This may be better than cluttering everything up that has basic questions and such. I also think that as we create "test" programs, that we can share them here for others to learn from simple, uncomplicated code.

I'll go first, attached is a simple program that I made to teach myself how to create Labels, Switches, Background Image, and an event on the switches (that changes text, as items are changed).

I'm hoping that we can all help each other learn more and more about this!

Sean

*File edited out*
 

bbrosemer

macrumors 6502a
Jan 28, 2006
639
3
Suggestion

Any code that is mentioned... id just say write for a small scaled down desktop version in regular cocoa.. then when the Interface Builder comes along... just port it to the iphone/itouch... Just a recommendation...that way there is no way of violating the NDA...
 

Sean7512

macrumors 6502a
Original poster
Jun 8, 2005
856
41
So, posting source code for an app that does nothing is really against the NDA?? The SDK is freely available for ANYONE, so I didn't realize that this would be a problem (Sorry!!). Can we at least ask each other which call to make to get a MessageBox open, etc?
 

Sean7512

macrumors 6502a
Original poster
Jun 8, 2005
856
41
Sure here is some code for doing just that :p

HAHAHA :p I was thinking more like "MessageBox.Show("THIS IS A MESSAGE BOX, STUPID!");" haha :)

Edit: Unfortunately it isn't this easy on the iPhone/iTouch....And a newb to Cocoa, can't figure it out :(
 

stevehp

macrumors 6502
Sep 4, 2006
459
0
It's not a house, it's a home.
Might want to wait for the NDA to be lifted first.

What NDA are you talking about? You can download the full SDK off developer.apple.com/iphone for free.

It's only a matter of time before there are comprehensive books and sites on idiots guides to iPhone/Cocoa Touch programming...By June, there'll be some great stuff already out there.

I have pretty much no programming experience and I want to find a good spot to gather info.

Good thread!
 

displaced

macrumors 65816
Jun 23, 2003
1,455
246
Gravesend, United Kingdom
Hi!

Funnily enough, this is exactly the thread I was hoping would be here...

Although the file's been removed, I'd still like to see the code. Would it be possible to re-post it, but edited to use the desktop Cocoa framework rather than that for the iPhone?

I've been playing with Xcode today. Written some classes that would form part of the core idea I've got... but as soon as it comes to hooking Interface Builder-created stuff into it, I'm lost :D

Imagine I've started with the basic 'Cocoa Application' template in Xcode and I have a class with some data fields and some accessors. The next bit, which I can't get my head around, is having a button that'll instantiate that class and some UI controls that'll bung some values into the class's fields via the accessor methods.

Do I need to scatter some (IBAction) tags around?!

(I think I've hit one of those things where my brain's object model isn't quite right :D)
 

Cromulent

macrumors 604
Oct 2, 2006
6,812
1,100
The Land of Hope and Glory
What NDA are you talking about? You can download the full SDK off developer.apple.com/iphone for free.

It's only a matter of time before there are comprehensive books and sites on idiots guides to iPhone/Cocoa Touch programming...By June, there'll be some great stuff already out there.

I have pretty much no programming experience and I want to find a good spot to gather info.

Good thread!

You need to register to download it. When your register you have to click accept on a license agreement. This license agreement is the NDA. Everyone who downloads the SDK is therefore bound to an NDA. It is not available to anyone, it is only available to those under an NDA.
 

admanimal

macrumors 68040
Apr 22, 2005
3,531
2
Practically speaking, the NDA is pretty much inconsequential to anything that people want to discuss in here. There is no way Apple is going to do anything to people on a forum just trying to learn stuff.
 

displaced

macrumors 65816
Jun 23, 2003
1,455
246
Gravesend, United Kingdom
(sorry -- this is a bit off the topic of the thread, but..)

DING-DING-DING!

I got my head around Interface Builder. Every example I'd looked at was for Xcode/IB 2.x, not 3. Linking XCode classes with IB seems to have changed somewhat. I was vainly dragging my class's interface file onto IB's MainMenu.nib window and getting annoyed that it wasn't appearing... so I thought I was completely off-track with the class implementation. Got it going now though :)

By the way, I'm finding the Cocoa For Scientists guide really helpful. Kevin Cathey's blog post on the changes in Interface Builder 3 explains how IB works in its latest incarnation.

(sorry again for the OTness :D)

(edit: coming from C#/.NET Framework, Cocoa feels.... baggy! And I don't mean that in a bad way. It's very good. I was sitting there thinking, "Where's the code behind the window? If there's no code behind that window, how do I instantiate my other class and call its method to do something when the button's clicked?"

It's just hit me that the interfaces made with IB are these fantastic (metaphorically) floating entities. I just have to write some code to do what I need and plug them into each other. Awesome!)
 

stevehp

macrumors 6502
Sep 4, 2006
459
0
It's not a house, it's a home.
Practically speaking, the NDA is pretty much inconsequential to anything that people want to discuss in here. There is no way Apple is going to do anything to people on a forum just trying to learn stuff.

I agree.

I guarantee Apple wouldn't have a problem with people discussing app development with the SDK...They clearly want people to develop apps as they have made it extremely accessible.

The NDA found in the terms and conditions is not unlike most beta software.

I'm no lawyer, but I can't see this being an issue.
 

Cromulent

macrumors 604
Oct 2, 2006
6,812
1,100
The Land of Hope and Glory
I agree.

I guarantee Apple wouldn't have a problem with people discussing app development with the SDK...They clearly want people to develop apps as they have made it extremely accessible.

The NDA found in the terms and conditions is not unlike most beta software.

I'm no lawyer, but I can't see this being an issue.

Actually this is incorrect.

Discussion of Xcode 3.1 has been banned on the Apple Xcode users mailing list and there is no iPhone Dev mailing list for the same reason. They obviously do have a problem with people discussing it.
 

Sean7512

macrumors 6502a
Original poster
Jun 8, 2005
856
41
This is just STUPID, STUPID, STUPID!!! Why does it matter if we share basic code and help each other??? Even if it is under a NDA, what does posting example code pose a threat too?? So a person would look at it and not really know what it does anyways, who cares????

I also guess that saying the iPhone simulator has no OpenGL support breaks the NDA too, right :rolleyes:

Apple, this is truly idiotic! Anyone care to agree with me??

Edit:
Sorry, I needed to vent!
 

GirthP

macrumors regular
Oct 1, 2007
121
0
ooh ooh, I wanna be in this club.

I'm learning as well :D.

I have a project I'm going to be started on tonight, I've been trying out tutorials, and freshening up on the limited amount of programming knowledge I've acquired in the past.

Can people join Groups on MacRumors:Forums?

Lets start the ObjCiPhoneNewbs Group.
 

vimacuser

macrumors newbie
Mar 10, 2008
2
0
alert/menubar applets..

I've got a query. First I'll give a brief use case. I trade stocks
automatically with my computer. There's automatic bailout functions
and stoplosses in place, but I'd like to be alerted when things go south regardless.

I'd like to write an application (perhaps actually two, as you'll see in a moment)
which A) alerts me of things going horribly wrong and B) Lets me view and see how things are doing
and control (stop trading, etc).

Part B is easy, I'm already well on my way to making that happen with a nice pretty gui, fancy
graphs and the ability to stop everything, or just one part.
Part A is the hard part. I can write a daemon, but that doesn't give me access to any sort of gui.
I'd like to produce some sort of menubar app, like the signal strength meter. parts A and B can,
of course, be seperate applications in the interest of memory and bandwidth savings.

My initial, very naive testing so far has been taking the basic test application and fork()ing.
Sadly, the child process doesn't get access to the GUI stuff. and obviously that might
take up more memory than I'd like.

Other things i've thought about are applications triggered via email, sms or instant message.
But all of those seem somewhat crufty, and require more levels of vulnerability to operate.

So, anyone know how I can write any sort of alert or menubar application?
 

Sean7512

macrumors 6502a
Original poster
Jun 8, 2005
856
41
Writing a menu bar application? I have no idea, as I am still learning the basics to Cocoa and Objective-C.

I do have a easy question for someone. I am making my background picture in photoshop for my app. I know the iPhone screen is 480x320, but what is the resolution of the space that our apps get? Don't forget that the menu bar takes up some space, but how much? Also, what is the iPhone's dpi?

Thanks!
 

cazlar

macrumors 6502
Oct 2, 2003
492
11
Sydney, Australia
So, anyone know how I can write any sort of alert or menubar application?
As far as the menu bar goes, from what I gather you can't write a daemon like you want to using the SDK, as your app only runs when it runs and is killed by the OS afterwards. I'm not sure what forking a new process will do, it may work. However, a number of the jailbreak apps have added icons to the bar to indicate daemon state, so it is possible to do it without the SDK (at least on 1.1.x, who knows for 2.0). It might be worth looking at the NES.app or taskbar notifier (I'm not sure if they are open source, but check), those two definitely do that.
 

Michael CM1

macrumors 603
Feb 4, 2008
5,682
277
Might want to wait for the NDA to be lifted first.

Is there a NDA for writing stuff for Mac OS? I'm going to try to learn to do this for both Mac OS and iPhone at the same time since they're so similar. I'm majorly managing hard drive space to do this. I think I'm gonna have to drop some clams on a 300GB hard drive soon. This 120GB is fillin' up.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.