PDA

View Full Version : Anybody here taking the stanford online course?




GenNovE
Apr 8, 2009, 03:16 PM
Hello,

I was wondering if anybody on this board is following the stanford iphone development course. Would love to interact with people following it so that we can help each other out throughout the process. I know in upcoming lectures
coding will be yielded towards group projects.

Like the tweet app etc.

So anybody willing to IM to discuss or know of a already established group?

I have been following the process and finished the assignments. But would really be awesome to converse with other people doing it.

By the way love this board Had a problem with a simple line of code and I recieved amazing help. THANK YOU



ooo
Apr 8, 2009, 03:58 PM
I forgot all about those videos. Watching it now.

crees!
Apr 8, 2009, 04:04 PM
I've been following. So glad they did this because it just rocks having access to an actual college-level course on the subject, for free too mind you.

simplymuzik3
Apr 8, 2009, 04:22 PM
How can I get access to it? Do I have to be going to the school? Im currently in gr11 high school and I live in Canada. Is there any way I could get it?

dejo
Apr 8, 2009, 04:37 PM
http://deimos3.apple.com/WebObjects/Core.woa/Browse/itunes.stanford.edu.2024353965.02024353968

plinx0r
Apr 8, 2009, 04:43 PM
Yep, I'm following the course and doing the assignments. I'm trying to think of the best way to help each other out. We could definitely use IM but what about setting up an IRC channel and just having everyone use that? Thoughts?

GenNovE
Apr 8, 2009, 05:45 PM
IIRC is definitely an option. We can IM each other through yahoo,me etc.
So far this course have been very informative towards obJC...

And who knows a macrumors developed native iphone app can arise from this.
The possibilities are endless.

What other options do you guys consider?

flatline82
Apr 9, 2009, 11:45 AM
I'm following them as well....so far its good stuff. I'm an IT, but I'm just now really looking into learning some programming languages...obviously that of iphone/touch objective C stuff. Just finding a starting point ya know?

Starting some sort of "focus" group isnt a half bad idea. Could bounce ideas and learn from one another, thats for sure. Technically...could be a Dev group ;)

danmanstx
Apr 9, 2009, 05:30 PM
i'm following as well, and it's well done so far. i'm a soon to be junior in CS/ComE and having a class on Obj-C is wonderful. I'd definitely be open to doing a group project or anything like that.

TopToffee
Apr 9, 2009, 06:54 PM
anyone else having trouble downloading lecture 2 and the related slides?

iphonerain
Apr 9, 2009, 07:08 PM
How advanced do I have to be in progamming already to be able to follow this class?? I'm having trouble downloading the video on itunes...

CocoaPuffs
Apr 9, 2009, 07:14 PM
You should have a pretty good understanding of basic programming if you want to keep up. The course itself is taken by a lot of CS grad students (base on the lecture I have heard so far), and it certainly isn't an entry level course.

macuser1997
Apr 10, 2009, 02:05 AM
You should have a pretty good understanding of basic programming if you want to keep up. The course itself is taken by a lot of CS grad students (base on the lecture I have heard so far), and it certainly isn't an entry level course.
The only prerequisites are the 2 intro CS classes Stanford has.

iSaga
Apr 10, 2009, 02:49 AM
I'm following along, it is really cool that they are offering this class for free. I'd be interested in a group as well.

blackmesa
Apr 10, 2009, 03:32 AM
Following also. Cool stuff:)

CocoaPuffs
Apr 10, 2009, 11:30 AM
The only prerequisites are the 2 intro CS classes Stanford has.
Hence I said you should be pretty familiar with the basic.

In a respectable CS program like Stanford, if you don't have A's in both of those classes, you won't be thinking about CS and certainly not this iPhone course. Therefore everyone that is in the actual Stanford iPhone course are VERY familiar with the basic of computer language.

macuser1997
Apr 10, 2009, 03:33 PM
Hence I said you should be pretty familiar with the basic.

In a respectable CS program like Stanford, if you don't have A's in both of those classes, you won't be thinking about CS and certainly not this iPhone course. Therefore everyone that is in the actual Stanford iPhone course are VERY familiar with the basic of computer language.

I got a C in the first CS course, B in the second, and am a CS major. I'm currently enrolled in CS193P.

How can you say crap like "if you don't have A's in both of those classes, you won't be thinking about CS" when it's just blatantly made up by you.

CocoaPuffs
Apr 10, 2009, 04:52 PM
I got a C in the first CS course, B in the second, and am a CS major. I'm currently enrolled in CS193P.

How can you say crap like "if you don't have A's in both of those classes, you won't be thinking about CS" when it's just blatantly made up by you.

I guess I am wrong about the "respectable" part, or you are simply special. If you can't get an A in intro classes for a competitive major, how do you demostrate your ability to succeed in the major?

What is the average Stanford CS students GPA for core prerequisites? I can't imagine sub 3.0 being the mean.

Wow, I guess CS is an open major in Stanford? My statement meant to apply to a competitive major that is not open enrollment.

ooo
Apr 10, 2009, 07:04 PM
I guess I am wrong about the "respectable" part, or you are simply special. If you can't get an A in intro classes for a competitive major, how do you demostrate your ability to succeed in the major?

What is the average Stanford CS students GPA for core prerequisites? I can't imagine sub 3.0 being the mean.

Wow, I guess CS is an open major in Stanford? My statement meant to apply to a competitive major that is not open enrollment.

I agree, getting a C in an intro class is pretty bad. It's going to only get harder. Regardless, if you enjoy it, keep going! Good luck with it.

plinx0r
Apr 10, 2009, 07:04 PM
Anyone feel like sharing their getter method for angleInRadians for Assignment 2A?

note: I'm not in the class so technically this isn't my hw. :cool:

macuser1997
Apr 10, 2009, 10:19 PM
If you can't get an A in intro classes for a competitive major, how do you demostrate your ability to succeed in the major?
It's news to me that you have to get straight As to be a successful CS major. This is really awful for me.

I guess I'll have to drop out and become a full-time iPhone app developer or switch to Women's Studies. Thank you for informing me.

plinx0r
Apr 11, 2009, 10:29 AM
Anyone feel like sharing their getter method for angleInRadians for Assignment 2A?

note: I'm not in the class so technically this isn't my hw. :cool:

n/m, i got it.

sirflashback
Apr 12, 2009, 10:09 AM
question answered ;)

great lectures btw!

swingerofbirch
Apr 12, 2009, 11:07 AM
I am watching the courses even though I am in way over my head. I need to learn C first (don't know anything) ( see this thread http://forums.macrumors.com/showthread.php?t=680658 ), but I figure like learning a foreign language it doesn't hurt to watch even though I really have no idea wth they are talking about--it might sink in by osmosis. :rolleyes:

macuser1997
Apr 12, 2009, 02:26 PM
I am watching the courses even though I am in way over my head. I need to learn C first (don't know anything) ( see this thread http://forums.macrumors.com/showthread.php?t=680658 ), but I figure like learning a foreign language it doesn't hurt to watch even though I really have no idea wth they are talking about--it might sink in by osmosis. :rolleyes:

Even for an experienced programmer, the lectures are mystifying and boring without context. Try to do the assignments, then watch the lectures and take notes, especially on the code samples. You'll understand where the lecture slide material fits in that way. Buy Stephen Kochan's "Programming in objective-C 2.0". Between that, the documentation, and the lectures, you should be able to grind through the assignments if you work real hard.

PM me if you get really stuck.

Alternatively, you can get "Beginning iPhone Development" by Mark and LeMarche. You'll know how to create iPhone apps, but you'll be missing a lot of the foundation that is important to know.

ataylor2009
Apr 13, 2009, 11:54 AM
anyone else having trouble downloading lecture 2 and the related slides?

No, but you're not missing much on this one...Lecture #2 had a different presenter than the first lecture, and he seemed totally unprepared. If I was paying money to go to Stanford I would be pissed that this was the quality I was getting.

Just my two cents' worth.

CocoaPuffs
Apr 13, 2009, 05:47 PM
No, but you're not missing much on this one...Lecture #2 had a different presenter than the first lecture, and he seemed totally unprepared. If I was paying money to go to Stanford I would be pissed that this was the quality I was getting.

Just my two cents' worth.
I agreed. It was definitely one of the lectures that could be better invested doing something else like napping.

assafliza
Apr 14, 2009, 06:00 AM
any one want to compare assignments? i have a little problem ...i need help..thanks

savemeanegg
Apr 14, 2009, 08:14 AM
No, but you're not missing much on this one...Lecture #2 had a different presenter than the first lecture, and he seemed totally unprepared. If I was paying money to go to Stanford I would be pissed that this was the quality I was getting.

Just my two cents' worth.

I am so glad you wrote this because this is exactly how I feel too. The presentation for lecture 2 was dire and yes he was totally unprepared!

I was screaming at my screen at how he was making it up as he went along!

As you say if I had paid for that lecture I would be asking for a refund.

I hope the rest are better otherwise I wont bother with them!

plinx0r
Apr 14, 2009, 08:45 AM
any one want to compare assignments? i have a little problem ...i need help..thanks

go ahead and post what you are having issues with. i'm sure others might have the same question.

rush0
Apr 14, 2009, 12:17 PM
we should make a user group on google or something.

makismagoo99
Apr 14, 2009, 03:34 PM
I am watching the courses even though I am in way over my head. I need to learn C first (don't know anything) ( see this thread http://forums.macrumors.com/showthread.php?t=680658 ), but I figure like learning a foreign language it doesn't hurt to watch even though I really have no idea wth they are talking about--it might sink in by osmosis. :rolleyes:

I'm in the same boat. I've been following along with the lectures and attempting the assignments. I'm for sure in way over my head. Despite having taken a class (and getting an 'A') on basic C programming in college, I don't have a great grasp on interacting with a programming language. One of the hardest parts for me is that a lot of the terminology is over my head. I think I can pick up the language, syntax, etc. but I find myself googling a lot of the words they're using. Oh well...

I also think rush0's idea of a google group or something of the sort would be pretty helpful. I tend to learn by following examples, so maybe some of you smart folks could help us slower ones along. :)

kage207
Apr 14, 2009, 04:13 PM
Well, I just started downloading the videos off iTunes. I also am downloading the PDFs. So hopefully this is relatively easy for me. :rolleyes: I know C++ (I got a C in the class cause I was lazy and didn't do the homework most of the time, just took it last semester. Easy transition from Java, just had to learn keywords), Java (I got a 100 in the class but I took it my junior year in high school), HTML and taught myself some PHP. Anyone know that it'll be easy or hard for me?

EDIT: Btw, I think if you get real bad problems, use iChat and take over the computer and show 'em what you are doing to their project to help 'em out.

macuser1997
Apr 14, 2009, 04:24 PM
There's a forum up for discussing CS193P asignments at http://appforums.com/viewforum.php?f=11&sid=46d26261c0c0abb154b13f709ba81ba1

CocoaPuffs
Apr 15, 2009, 02:14 AM
Why not just do it here.

savemeanegg
Apr 15, 2009, 04:43 AM
I certainly would not base this content on a way to learn iPhone programming as am now in lecture 3 and am less than impressed.

Interesting to watch, but to learn a great deal from I don't think so.

assafliza
Apr 15, 2009, 06:27 AM
someone can upload the solutions for 2b and 2b that we can compare?

ChOas
Apr 15, 2009, 02:38 PM
someone can upload the solutions for 2b and 2b that we can compare?

I'm just getting started with this course and this is my implementation for PolygonShape (2a). Still needs some optimising and errorchecking but hey:


#import "PolygonShape.h"


@implementation PolygonShape

@synthesize numberOfSides, minimumNumberOfSides, maximumNumberOfSides, name;

- (void) setNumberOfSides:(int) numSides {
if (numSides > maximumNumberOfSides) {
NSLog(@"Invalid number of sides: %d is greater than the maximum of %d allowed",numSides, maximumNumberOfSides);
return;
}
if (numSides < minimumNumberOfSides) {

NSLog(@"Invalid number of sides: %d is less than the minimmum of %d allowed",numSides, minimumNumberOfSides);
return;
}
numberOfSides = numSides;
}

- (void) setMinimumNumberOfSides:(int) newMin {
if (newMin < 2) {
NSLog(@"Invalid number of minimum sides, %d is less than 2", newMin);
return;
}
minimumNumberOfSides = newMin;
}

- (void) setMaximumNumberOfSides:(int) newMax {
if (newMax > 12) {
NSLog(@"Invalid number of maximum sides, %d is more than 2", newMax);
return;
}
maximumNumberOfSides = newMax;
}

- (id) initWithNumberOfSides: (int) numSides minimumNumberOfSides:(int) minSides maximumNumberOfSides:(int) maxSides {
[self setMinimumNumberOfSides:minSides];
[self setMaximumNumberOfSides:maxSides];
[self setNumberOfSides:numSides];
NSLog([self description]);
return self;
};

- (id) init {
return self = [[PolygonShape alloc] initWithNumberOfSides:5 minimumNumberOfSides:3 maximumNumberOfSides:10];
};

- (NSString *) description {

float degAngle = (float) (180 * (float) (numberOfSides-2) / numberOfSides);
float radAngle = (float) degAngle/180 * M_PI;
NSArray *polyName = [NSArray arrayWithObjects: @"triangle", @"square", @"pentagon", @"hexagon", @"heptagon",
@"octagon" , @"enneagon", @"decagon", @"hendecagon", @"dodecagon", nil];

return [NSString stringWithFormat:@"Hello, I am a %d-sided polygon (aka a %@) with angles of %0.0f degrees (%f radians).",
numberOfSides, [polyName objectAtIndex: (numberOfSides-3)], degAngle, radAngle];
}

- (void) dealloc {
[super dealloc];
NSLog(@"A poly just died");
};
@end

ChOas
Apr 15, 2009, 03:33 PM
With the same PolygonShape I used this for the Controller implementation of 2b:

#import "Controller.h"
#import "PolygonShape.h"

@implementation Controller

- (void) updateInterface {
numberOfSidesLabel.text = [NSString stringWithFormat:@"%d",polygon.numberOfSides];
}

- (IBAction)decrease:(id)sender {
NSLog(@"decreasing");
--polygon.numberOfSides;
if (polygon.numberOfSides == polygon.minimumNumberOfSides) decreaseButton.enabled = NO;
increaseButton.enabled = YES;
[self updateInterface];
}

- (IBAction)increase:(id)sender {
NSLog(@"increasing");
++polygon.numberOfSides;
if (polygon.numberOfSides == polygon.maximumNumberOfSides) increaseButton.enabled = NO;
decreaseButton.enabled = YES;
[self updateInterface];
}



- (void) awakeFromNib {
polygon = [[PolygonShape alloc] initWithNumberOfSides:5 minimumNumberOfSides:3 maximumNumberOfSides:12];
NSLog(@"My polygon: %@", polygon);
[self updateInterface];
}
@end

polygon should be dealloced, I know... Will happen.

also checks before in/de creasing the num of sides would be better as in the future other things might influence the side count.

Oh well...

Hmmm maybe I should go for

[polygon setNumberOfSides:polygon.numberOfSides[+-]1]


Is the accessor called when I use the ++ / -- operands ?

[edit]
Ah, it is... sweet.

stevet
Apr 16, 2009, 06:19 AM
- (NSString *) description {

float degAngle = (float) (180 * (float) (numberOfSides-2) / numberOfSides);
float radAngle = (float) degAngle/180 * M_PI;
NSArray *polyName = [NSArray arrayWithObjects: @"triangle", @"square", @"pentagon", @"hexagon", @"heptagon",
@"octagon" , @"enneagon", @"decagon", @"hendecagon", @"dodecagon", nil];

return [NSString stringWithFormat:@"Hello, I am a %d-sided polygon (aka a %@) with angles of %0.0f degrees (%f radians).",
numberOfSides, [polyName objectAtIndex: (numberOfSides-3)], degAngle, radAngle];
}



Chaos,
I'm curious, did you make angle and radians read only properties? I think that was specified in the assignment. Aka

@property (readonly) float angleInDegrees;
@property (readonly) float angleInRadians;


And then implement methods for them.

Also, just a slight critique on the use of 'return'. It's much cleaner and easier to read/follow the code if you use :

if
{

}
else
{

}

rather than returning from within the 'if'. Just my $0.02.

ChOas
Apr 16, 2009, 06:57 AM
Hi Steve,

1: Good one, dunno why I actually follow that through, mind must have been wandering off :)

2: The return statements in the ifs is a Perl habit I happen to have :)

Thanks for commenting, will update my class

stevet
Apr 16, 2009, 06:40 PM
Hi Steve,

1: Good one, dunno why I actually follow that through, mind must have been wandering off :)

2: The return statements in the ifs is a Perl habit I happen to have :)

Thanks for commenting, will update my class

Yeah, it's not really a big deal, I'm used to working in teams, easy to read and 'clean' become a factor.... It's functional either way.

mccannmarc
Apr 16, 2009, 06:57 PM
Yeah, it's not really a big deal, I'm used to working in teams, easy to read and 'clean' become a factor.... It's functional either way.

Bugs me too to be honest, call me fussy but I've also got a deep hatred for if's without braces e.g:-

if(condition == true)
DoSomething;


Its horrible! (even if it is a single line, and its even more annoying when its followed by an else!)

if(condition == true)
{
DoSomething;
}

The above doesn't kill and to be honest it is much more readable! God knows how the hell not using the braces was ever accepted as a standard

CocoaPuffs
Apr 16, 2009, 10:03 PM
Ya, writing horrible looking codes is as bad as writing non-working codes in most cases, unless of course, you're a one-man team and you simply don't care.

thomasjt
Apr 16, 2009, 11:13 PM
Hi everyone,

I'm having a real problem just itterating through the array and printing out the objects' className. Here is what I have so far:

void PrintIntrospectionInfo() {

NSMutableArray *myObjects;
myObjects = [[NSMutableArray alloc] init];
NSString *myString = @"bob";
NSMutableString *myMutableString = @"floyd";
NSURL *myURLs = [NSURL URLWithString:@"http://google.com.au"];
NSDictionary *myDictionary = [NSDictionary dictionaryWithObjectsAndKeys:@"happy", @"smile", @"sad", @"frown"];
NSString *myProcessName = [[NSProcessInfo processInfo] processName];

[myObjects addObject:myString]; //there has got to be a better way to do this
[myObjects addObject:myMutableString];
[myObjects addObject:myURLs];
[myObjects addObject:myDictionary];
[myObjects addObject:myProcessName];


for (id obj in myObjects) {
NSLog(@"Class Name: %@", [obj className]);

}

}

Any ideas?

EDIT: I should mention the problem I guess :) = nothing prints out in the console at all.

makismagoo99
Apr 17, 2009, 02:57 AM
I'm having some trouble with assignment 1B...here's my code for section 1:


void PrintPathInfo() {

NSString *path = @"~";

NSArray *array = [path pathComponents];
NSLog(@"%@",
[array componentsJoinedByString:@"/"]);


}

I can't figure out how to expand the "~" into the actual path, any suggestions?

thomasjt
Apr 17, 2009, 03:05 AM
I think you should check out the stringByExpandingTildeInPath method. It's handy for doing the expansion.

plinx0r
Apr 17, 2009, 10:45 PM
Why haven't they posted Wednesday's class yet? :(

makismagoo99
Apr 17, 2009, 11:06 PM
I think you should check out the stringByExpandingTildeInPath method. It's handy for doing the expansion.

I don't quite understand how the syntax works, can someone explain?

From Apple's documentation:
- (NSString *)stringByExpandingTildeInPath

I don't get how to pass the string from my above code to this line...
Also, I understand that a * indicates a pointer when used as in *variable, what does the * indicate here?

plinx0r
Apr 17, 2009, 11:43 PM
I don't quite understand how the syntax works, can someone explain?


example:

NSString *path = @"~";
path = [path stringByExpandingTildeInPath];

makismagoo99
Apr 18, 2009, 12:33 AM
example:

NSString *path = @"~";
path = [path stringByExpandingTildeInPath];


Ah that makes more sense. And it works! Thanks :)

brianus
Apr 18, 2009, 12:48 PM
Why haven't they posted Wednesday's class yet? :(

Yeah, what's the deal? On the course site they have a link for Lecture 5 (http://deimos3.apple.com/WebObjects/Core.woa/Browse/itunes.stanford.edu.2024353965.02024599579.2056922861?i=1834780889), but when it comes up in iTunes it only shows the PDF for that one, no video. Oddly, if I try to get to the course through the iTunes store (http://deimos3.apple.com/WebObjects/Core.woa/Browse/itunes.stanford.edu.2024353965.02024599579) rather than that one link, it only shows PDFs 1-4.. the heck?

thomasjt
Apr 20, 2009, 06:25 AM
Has anyone finished assignment three yet? If so would you like to post your code for us to check out?

Cheers,

Tom

plinx0r
Apr 20, 2009, 12:51 PM
Yeah, what's the deal? On the course site they have a link for Lecture 5 (http://deimos3.apple.com/WebObjects/Core.woa/Browse/itunes.stanford.edu.2024353965.02024599579.2056922861?i=1834780889), but when it comes up in iTunes it only shows the PDF for that one, no video. Oddly, if I try to get to the course through the iTunes store (http://deimos3.apple.com/WebObjects/Core.woa/Browse/itunes.stanford.edu.2024353965.02024599579) rather than that one link, it only shows PDFs 1-4.. the heck?

fyi, lecture #5 is now available.

simonjfrancis
Apr 21, 2009, 12:09 AM
Hi,

ChOas, would you (or anyone else) mind posting your Controller.h

Whenever I try to compile my (early stages) HelloPoly project I get "error PolygonShape/PolygonShape.h :No such file or directory

I have this line in the Controller.m
#import "PolygonShape.h"


And here is my incomplete Controller.h
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <PolygonShape/PolygonShape.h>

@class PolygonShape;

@interface Controller : NSObject {
IBOutlet UIButton *decreaseButton;
IBOutlet UIButton *increaseButton;
IBOutlet UILabel *numberOfSidesLabel;
IBOutlet PolygonShape *polygon;

}

- (IBAction)decrease;
- (IBAction)increase;
@end


Any help is much appreciated.

regards, Simon

With the same PolygonShape I used this for the Controller implementation of 2b:

#import "Controller.h"
#import "PolygonShape.h"

@implementation Controller

- (void) updateInterface {
numberOfSidesLabel.text = [NSString stringWithFormat:@"%d",polygon.numberOfSides];
}

- (IBAction)decrease:(id)sender {
NSLog(@"decreasing");
--polygon.numberOfSides;
if (polygon.numberOfSides == polygon.minimumNumberOfSides) decreaseButton.enabled = NO;
increaseButton.enabled = YES;
[self updateInterface];
}

- (IBAction)increase:(id)sender {
NSLog(@"increasing");
++polygon.numberOfSides;
if (polygon.numberOfSides == polygon.maximumNumberOfSides) increaseButton.enabled = NO;
decreaseButton.enabled = YES;
[self updateInterface];
}



- (void) awakeFromNib {
polygon = [[PolygonShape alloc] initWithNumberOfSides:5 minimumNumberOfSides:3 maximumNumberOfSides:12];
NSLog(@"My polygon: %@", polygon);
[self updateInterface];
}
@end

polygon should be dealloced, I know... Will happen.

also checks before in/de creasing the num of sides would be better as in the future other things might influence the side count.

Oh well...

Hmmm maybe I should go for

[polygon setNumberOfSides:polygon.numberOfSides[+-]1]


Is the accessor called when I use the ++ / -- operands ?

[edit]
Ah, it is... sweet.

thomasjt
Apr 21, 2009, 01:03 AM
Hi simonjfrancis,

I found that I had to put the full path to my PolygonShape.h file, such as:

#import </Users/Tom/Documents/Assignment 2/PolygonShape.h>

I don't know why - it was in the same directory as my other source files. But anyway that might help.

Tom

ChOas
Apr 21, 2009, 02:07 AM
I think the problem you gusys are having is the mixing of "" and <> around the import of PolygonShape.

As far as I understand the <> will look for the file relative to the library path and "" wil look for the file relative to the current project.

So:
#import </Users/Tom/Documents/Assignment 2/PolygonShape.h>
Wil look in the absolute path as it starts with a /

#import "PolygonShape.h"
will include the .h from your current project directory

#import <PolygonShape/PolygonShape.h>
will start looking for the file in <Library path>/PolygonShape

Simon, if you change
#import <PolygonShape/PolygonShape.h>
to:
#import "PolygonShape.h"

It should work, I think.

simonjfrancis
Apr 21, 2009, 12:09 PM
Thanks for the replies.

I tried changing from #import <> to #import "" but that had no effect.

What ended up working for me was to add a search path to my xcode settings.

In Xcode 3, choose Project > Edit Project Settings to modify your project's build settings (build tab). In the Search Paths collection are settings to add search paths for header files, libraries, and frameworks.
I added /Users/simon/Documents/ (with the recursive option checked) and then it found my header file and compiled (after some other non-compile related issues were resolved).

hope this helps someone else.

regards, Simon

JLatte
Apr 21, 2009, 02:01 PM
@simon: Here is my code thus far:

First is Controller.h
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import "PolygonShape.h"

@interface Controller : NSObject {
IBOutlet UIButton *decreaseButton;
IBOutlet UIButton *increaseButton;
IBOutlet UILabel *numberOfSidesLabel;
IBOutlet PolygonShape *aPolygon;
}
- (IBAction)decrease;
- (IBAction)increase;

@property (nonatomic, retain) UIButton *decreaseButton;
@property (nonatomic, retain) UIButton *increaseButton;
@property (nonatomic, retain) UILabel *numberOfSidesLabel;
@property (nonatomic, retain) PolygonShape *aPolygon;

@end

Here is Controller.m:
#import "Controller.h"

@implementation Controller
@synthesize numberOfSidesLabel;
@synthesize increaseButton;
@synthesize decreaseButton;
@synthesize aPolygon;

- (IBAction)decrease
{
--aPolygon.numberOfSides;
[self updateInterface];
}

- (IBAction)increase
{
++aPolygon.numberOfSides;
[self updateInterface];
}

-(void)awakeFromNib
{
aPolygon = [[PolygonShape alloc] initWithNumberOfSides:numberOfSidesLabel.text.integerValue minimumNumberOfSides:3 maximumNumberOfSides:12];
NSLog(@"My polygon: %@", [aPolygon polyDescription]);
}

-(void)updateInterface
{

numberOfSidesLabel.text = [NSString stringWithFormat:@"%d", [aPolygon numberOfSides]];
if (aPolygon.numberOfSides == aPolygon.minimumNumberOfSides)
{
decreaseButton.enabled = NO;
}
else
{
decreaseButton.enabled = YES;
}
if (aPolygon.numberOfSides == aPolygon.maximumNumberOfSides)
{
increaseButton.enabled = NO;
}
else
{
increaseButton.enabled = YES;
}
}


@end

thomasjt
Apr 21, 2009, 05:17 PM
@ChOas:

Thanks very much for that, I didn't really know about the " versus the <> thing :)

simonjfrancis
Apr 21, 2009, 10:41 PM
JLatte,

thanks for providing your code. It was very helpful for me to identify a number of issues that were improperly implemented in my code. I also wasn't clear on how the updateInterface method was supposed to be called until I saw your how you did it. It'd be greatly appreciated if you (or others) are willing to continue to post working code.

thanks in advance.

simon

bbrosemer
Apr 22, 2009, 01:24 AM
Hi simonjfrancis,

I found that I had to put the full path to my PolygonShape.h file, such as:

#import </Users/Tom/Documents/Assignment 2/PolygonShape.h>

I don't know why - it was in the same directory as my other source files. But anyway that might help.

Tom

You may not have copied the item ... the best way to add files in Xcode is to say the file is on your desktop too then while the Project is open in Xcode to drag that file into classes ... if it is a class file ... then a little menu will drop down saying would you like to copy the file ... You should turn the checkbox on 99% of the time ... then click ok and you will be all set and the #import<file.h> should work fine then

bbrosemer
Apr 22, 2009, 01:25 AM
@simon: Here is my code thus far:

First is Controller.h
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import "PolygonShape.h"

@interface Controller : NSObject {
IBOutlet UIButton *decreaseButton;
IBOutlet UIButton *increaseButton;
IBOutlet UILabel *numberOfSidesLabel;
IBOutlet PolygonShape *aPolygon;
}
- (IBAction)decrease;
- (IBAction)increase;

@property (nonatomic, retain) UIButton *decreaseButton;
@property (nonatomic, retain) UIButton *increaseButton;
@property (nonatomic, retain) UILabel *numberOfSidesLabel;
@property (nonatomic, retain) PolygonShape *aPolygon;

@end

Here is Controller.m:
#import "Controller.h"

@implementation Controller
@synthesize numberOfSidesLabel;
@synthesize increaseButton;
@synthesize decreaseButton;
@synthesize aPolygon;

- (IBAction)decrease
{
--aPolygon.numberOfSides;
[self updateInterface];
}

- (IBAction)increase
{
++aPolygon.numberOfSides;
[self updateInterface];
}

-(void)awakeFromNib
{
aPolygon = [[PolygonShape alloc] initWithNumberOfSides:numberOfSidesLabel.text.integerValue minimumNumberOfSides:3 maximumNumberOfSides:12];
NSLog(@"My polygon: %@", [aPolygon polyDescription]);
}

-(void)updateInterface
{

numberOfSidesLabel.text = [NSString stringWithFormat:@"%d", [aPolygon numberOfSides]];
if (aPolygon.numberOfSides == aPolygon.minimumNumberOfSides)
{
decreaseButton.enabled = NO;
}
else
{
decreaseButton.enabled = YES;
}
if (aPolygon.numberOfSides == aPolygon.maximumNumberOfSides)
{
increaseButton.enabled = NO;
}
else
{
increaseButton.enabled = YES;
}
}


@end

Know of any practical reasons of using -(id) versus -(void) ... is there any benefits to one or the other i usually just use -(void) for my functions that return nothing ... but -(id) works as well ...

linugen
Apr 22, 2009, 09:04 AM
@thomasjt

try replacing this:
for (id obj in myObjects) {
NSLog(@"Class Name: %@", [obj className]);

}

by this:
for (id *obj in myObjects) {
NSLog(@"Class Name: %@", [obj className]);

}

becu
Apr 22, 2009, 10:52 AM
i don't think you need it, id type creates pointer already

becu
Apr 23, 2009, 11:35 AM
i'm still on 2B
The NSLog message won't load in console. but if I try to change value of the text label as I click "Increase", "Decrease" buttons, the value changed accordingly. so i think my connections are correct, but for some reason NSLog won't work. anybody got this problem? I need to get this fix otherwise I can't debug, test my apps.

Thanks.

thomasjt
Apr 24, 2009, 08:14 AM
Thanks linugen, much appreciated.

CocoaPuffs
Apr 24, 2009, 05:15 PM
@ChOas:

Thanks very much for that, I didn't really know about the " versus the <> thing :)

<> is reserve for special system folder, which you won't use unless you are referring to framework. "" is what you should always use.

plinx0r
Apr 25, 2009, 04:15 PM
Quick question that has been bugging me for a while since I've watched Evan's lectures:

In xcode, when writing something such as UIBarButtonSystem, what is the key combination to popup the list of possible options? Right now I have it so that I can tab and auto-complete the suggested item but how do I view the list of options? I've checked "Show arguments in pop-up list" under preferences but that didn't seem to help.

Thanks in advance :apple:

plinx0r
Apr 25, 2009, 04:52 PM
n/m I found the answer. I guess I wasn't using the best search terms originally. the shortcut by default is set to: control ,

CocoaPuffs
Apr 25, 2009, 08:06 PM
Isn't it just "esc" key, which is much easier to push?

plinx0r
Apr 25, 2009, 08:57 PM
Isn't it just "esc" key, which is much easier to push?

cool, that works too. thanks. :D

yayaba
Apr 28, 2009, 02:52 AM
I can personally vouch for this course. I knew almost next to nothing about how to begin programming an app and after spending a lot of time with this course I'm about halfway done with my first app now.

Googling around for tutorials wasn't helping -- I needed a structured approach to learning Obj C and for me this class was a huge help.

CocoaPuffs
Apr 28, 2009, 10:17 AM
I can personally vouch for this course. I knew almost next to nothing about how to begin programming an app and after spending a lot of time with this course I'm about halfway done with my first app now.

Googling around for tutorials wasn't helping -- I needed a structured approach to learning Obj C and for me this class was a huge help.
How about reading a book, "Beginning iPhone Development" would have taken you further and deeper into most subjects they have discussed in class. The class should only be used as reference, not the main learning source. I am falling asleep through these lectures.

thomasjt
May 9, 2009, 10:14 PM
I'm having some problems with assignment three.

I have three custom classes: Controller, PolygonShape, and UIPolygonView

In the assignment handouts, Evan says that you need to give your custom UIView class access to your PolygonShape. Does anyone know how to do that?

In the UIPolygonView class I am trying to set up some draw code, but when I try something like

int sideToDraw = [aPolygonShape numberOfSides]

...I get the familiar 'error: aPolygonShape undeclared (first use in this function).' error message.

I realise it's probably some very basic class knowledge I am lacking here, but how do I let my UIPolyView see the instance of a PolygonShape that I created in my Controller class?

Many thanks for any help.

plinx0r
May 9, 2009, 11:16 PM
I'm having some problems with assignment three.

I have three custom classes: Controller, PolygonShape, and UIPolygonView

In the assignment handouts, Evan says that you need to give your custom UIView class access to your PolygonShape. Does anyone know how to do that?

In the UIPolygonView class I am trying to set up some draw code, but when I try something like

int sideToDraw = [aPolygonShape numberOfSides]

...I get the familiar 'error: aPolygonShape undeclared (first use in this function).' error message.

I realise it's probably some very basic class knowledge I am lacking here, but how do I let my UIPolyView see the instance of a PolygonShape that I created in my Controller class?

Many thanks for any help.

Where do you allocate and initialize aPolygonShape? Did you #import?

thomasjt
May 10, 2009, 01:46 AM
I alloc'd it in the Controller.m file - should I import that?

Or, in Controller.m should I alloc a polygonShape, and a polygonView, and then pass [polygonShape numberOfSides] to the PolygonView somehow?

Sorry for what seems to me to be a very confusing question :)

theagentx
May 10, 2009, 03:01 PM
I am going to start watching them this week. Even tho I am a total newb to programming. I think it will accelerate the learning curve. Are they teaching any Objective-c in there?

jeevesofRKdia
May 10, 2009, 09:19 PM
I am going to start watching them this week. Even tho I am a total newb to programming. I think it will accelerate the learning curve. Are they teaching any Objective-c in there?

I think that's pretty much ALL they're teaching :p

But they are assuming some familiarity with C and basic programming in general. I've learned VBA, SQL, and HTML and I'm pretty confused as none of those are really object-oriented programming languages.

Good luck though!

kwelling
Sep 6, 2009, 04:25 PM
Ok... so in the assignment 2a specs it states to make angleInRadians, angleInDegrees and name all properties but to not have them backed by an iVar.

Is this possible?

I keep getting compiler errors that the synthesized property must be named the same as a compatible ivar or must explicitly name an iVar.

kwelling
Sep 6, 2009, 05:41 PM
Ok... so in the assignment 2a specs it states to make angleInRadians, angleInDegrees and name all properties but to not have them backed by an iVar.

Is this possible?

I keep getting compiler errors that the synthesized property must be named the same as a compatible ivar or must explicitly name an iVar.

NM... so you can declare a @property and just not @synthesize it...