Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Mar 8, 2008, 01:17 AM   #1
Sean7512
macrumors 6502a
 
Join Date: Jun 2005
Learning iPhone Code Together!

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*
__________________
Check out my iOS Apps - Pilot Ace - iPhone/iPad | the Lunch Train - iPhone Only
Be Yourself, Only Better

Last edited by Sean7512; Mar 8, 2008 at 12:09 PM.
Sean7512 is offline   0 Reply With Quote
Old Mar 8, 2008, 07:25 AM   #2
Cromulent
macrumors 603
 
Cromulent's Avatar
 
Join Date: Oct 2006
Location: The Land of Hope and Glory
Might want to wait for the NDA to be lifted first.
__________________
Neural Advance - Mac OS X, UNIX and Windows Development
Last.fm Profile | Extreme Metal Reviews
MP 4x 2.66Ghz Xeons / 6GB RAM / 640GB + 500GB + 750GB + 1TB HDDs / ATI Radeon 4870 / iPad 3
Cromulent is offline   0 Reply With Quote
Old Mar 8, 2008, 11:48 AM   #3
bbrosemer
macrumors 6502a
 
bbrosemer's Avatar
 
Join Date: Jan 2006
Send a message via AIM to bbrosemer
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...
__________________
Can't we all just get along and where Windows and Mac can coexist, ... O wait we already have, thanks Apple
bbrosemer is offline   0 Reply With Quote
Old Mar 8, 2008, 12:11 PM   #4
Sean7512
Thread Starter
macrumors 6502a
 
Join Date: Jun 2005
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?
__________________
Check out my iOS Apps - Pilot Ace - iPhone/iPad | the Lunch Train - iPhone Only
Be Yourself, Only Better
Sean7512 is offline   0 Reply With Quote
Old Mar 8, 2008, 12:15 PM   #5
kainjow
Moderator emeritus
 
kainjow's Avatar
 
Join Date: Jun 2000
Quote:
Originally Posted by Sean7512 View Post
Can we at least ask each other which call to make to get a MessageBox open, etc?
Sure here is some code for doing just that
kainjow is offline   0 Reply With Quote
Old Mar 8, 2008, 12:17 PM   #6
Sean7512
Thread Starter
macrumors 6502a
 
Join Date: Jun 2005
Quote:
Originally Posted by kainjow View Post
Sure here is some code for doing just that
HAHAHA 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
__________________
Check out my iOS Apps - Pilot Ace - iPhone/iPad | the Lunch Train - iPhone Only
Be Yourself, Only Better
Sean7512 is offline   0 Reply With Quote
Old Mar 8, 2008, 12:20 PM   #7
stevehp
macrumors 6502
 
Join Date: Sep 2006
Location: It's not a house, it's a home.
Quote:
Originally Posted by Cromulent View Post
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!
__________________
15" Unibody MBP/2.66GHZ/320GB HD/8GB RAM
24" Apple LED Cinema Display
32GB iPhone 5
16GB WiFi/3G iPad 2
stevehp is offline   0 Reply With Quote
Old Mar 8, 2008, 12:43 PM   #8
displaced
macrumors 65816
 
displaced's Avatar
 
Join Date: Jun 2003
Location: Gravesend, United Kingdom
Send a message via AIM to displaced Send a message via MSN to displaced Send a message via Skype™ to displaced
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

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 )
__________________
CONGRATURATION! YOU SUCCESS!
A WINNER IS YOU!
BUT OUR GIRAFFE IS IN ANOTHER CASTLE!
displaced is offline   0 Reply With Quote
Old Mar 8, 2008, 01:01 PM   #9
Cromulent
macrumors 603
 
Cromulent's Avatar
 
Join Date: Oct 2006
Location: The Land of Hope and Glory
Quote:
Originally Posted by stevehp View Post
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.
__________________
Neural Advance - Mac OS X, UNIX and Windows Development
Last.fm Profile | Extreme Metal Reviews
MP 4x 2.66Ghz Xeons / 6GB RAM / 640GB + 500GB + 750GB + 1TB HDDs / ATI Radeon 4870 / iPad 3
Cromulent is offline   0 Reply With Quote
Old Mar 8, 2008, 01:25 PM   #10
admanimal
macrumors 68040
 
Join Date: Apr 2005
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.
admanimal is offline   0 Reply With Quote
Old Mar 8, 2008, 02:57 PM   #11
displaced
macrumors 65816
 
displaced's Avatar
 
Join Date: Jun 2003
Location: Gravesend, United Kingdom
Send a message via AIM to displaced Send a message via MSN to displaced Send a message via Skype™ to displaced
(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 )

(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!)
__________________
CONGRATURATION! YOU SUCCESS!
A WINNER IS YOU!
BUT OUR GIRAFFE IS IN ANOTHER CASTLE!

Last edited by displaced; Mar 8, 2008 at 03:09 PM.
displaced is offline   0 Reply With Quote
Old Mar 8, 2008, 03:15 PM   #12
barijazz
macrumors 6502
 
Join Date: Dec 2007
Send a message via AIM to barijazz
This place has been really helpful to me http://cocoadevcentral.com/. I'm very happy that someone made this forum. I have a lot of questions and the support is always welcome.
__________________
"Is our children learning", George W. Bush President of the United States of America 2001-2009

Last edited by barijazz; Mar 8, 2008 at 04:58 PM.
barijazz is offline   0 Reply With Quote
Old Mar 8, 2008, 03:39 PM   #13
stevehp
macrumors 6502
 
Join Date: Sep 2006
Location: It's not a house, it's a home.
Quote:
Originally Posted by admanimal View Post
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.
__________________
15" Unibody MBP/2.66GHZ/320GB HD/8GB RAM
24" Apple LED Cinema Display
32GB iPhone 5
16GB WiFi/3G iPad 2
stevehp is offline   0 Reply With Quote
Old Mar 8, 2008, 04:54 PM   #14
Cromulent
macrumors 603
 
Cromulent's Avatar
 
Join Date: Oct 2006
Location: The Land of Hope and Glory
Quote:
Originally Posted by stevehp View Post
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.
__________________
Neural Advance - Mac OS X, UNIX and Windows Development
Last.fm Profile | Extreme Metal Reviews
MP 4x 2.66Ghz Xeons / 6GB RAM / 640GB + 500GB + 750GB + 1TB HDDs / ATI Radeon 4870 / iPad 3
Cromulent is offline   0 Reply With Quote
Old Mar 10, 2008, 07:12 PM   #15
Sean7512
Thread Starter
macrumors 6502a
 
Join Date: Jun 2005
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

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

Edit:
Sorry, I needed to vent!
__________________
Check out my iOS Apps - Pilot Ace - iPhone/iPad | the Lunch Train - iPhone Only
Be Yourself, Only Better

Last edited by Sean7512; Mar 10, 2008 at 07:19 PM.
Sean7512 is offline   0 Reply With Quote
Old Mar 10, 2008, 09:36 PM   #16
GirthP
macrumors regular
 
Join Date: Oct 2007
ooh ooh, I wanna be in this club.

I'm learning as well .

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.
__________________
iPhone 16GB 3G
Home: 2.2 MBP 4GB 320GB WD Scorpio

Work: 8 core 2.8 MP 8GB w/ 2 24" Dell UltraSharps
GirthP is offline   0 Reply With Quote
Old Mar 11, 2008, 12:18 AM   #17
vimacuser
macrumors newbie
 
Join Date: Mar 2008
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?
vimacuser is offline   0 Reply With Quote
Old Mar 12, 2008, 10:12 PM   #18
Sean7512
Thread Starter
macrumors 6502a
 
Join Date: Jun 2005
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!
__________________
Check out my iOS Apps - Pilot Ace - iPhone/iPad | the Lunch Train - iPhone Only
Be Yourself, Only Better
Sean7512 is offline   0 Reply With Quote
Old Mar 12, 2008, 10:44 PM   #19
cazlar
macrumors 6502
 
Join Date: Oct 2003
Location: Sydney, Australia
Quote:
Originally Posted by vimacuser View Post
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.
cazlar is offline   0 Reply With Quote
Old Mar 12, 2008, 11:18 PM   #20
Michael CM1
macrumors 601
 
Join Date: Feb 2008
Quote:
Originally Posted by Cromulent View Post
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.
__________________
13.3" 2014 MacBook Air; Mid-2010 21.5" iMac; silver iPhone 5S 32GB (silver 64GB iPhone 6 coming soon!); white iPad Air 32 GB; third-gen TV (x2)
Michael CM1 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Learning to Code: Where to Start? ToomeyND Mac Programming 11 Mar 5, 2014 01:27 PM
learning x-code .. need advice ! rashidyn iPhone/iPad Programming 39 Apr 24, 2013 02:37 PM
App of learning counting in Multi-language (including Promo code) Magdalen iPhone and iPod touch Apps 0 Nov 13, 2012 03:51 AM
Learning to code... SR71 iPhone/iPad Programming 9 Oct 11, 2012 07:20 PM
Learning Code oxxygenn Mac Programming 3 Jul 19, 2012 09:15 PM

Forum Jump

All times are GMT -5. The time now is 11:28 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC