Hello,
I have learned some basic Java, but now I want to learn Objective-C. Is there a tutorial or problem set of programs to make that I can follow to quickly learn the basics? Here is what I know how to do so far...
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[]) { //wants an int, 0=normal, 1=abnormal
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];//sets up memory pool for program
// line type comment
/* multi line type comment
*/
int a, b, mod; //can declare more than one
int num = 8; a=2+1;
NSLog(@"Hello! Use %i for an integer", num); //@"string" is a constant NSString object
//"string" is a constant C-style string object
NSLog (@"more than one %i %i", num, a);
NSLog(@"carriage return\ntab\tsomething\nreversetab\rbleeeeeeeep\nbackspace\bbleep\nslosh\\");
mod = 3%4;
float var = 8.223; float var2 = 1.0;
double g = 2.0;
NSLog(@"%i %i %i %f %i", mod, 9%3, 5%2, var, fmod(var,var2) );//how to use fmod?
NSLog(@"dunno for double", g);
NSLog(@"%f %.f %.1f %.2f", var, var, var, var);
NSString* formattedNumber = [NSString stringWithFormat:@"%.02f", var];
NSLog(formattedNumber);
NSString* stringy = @"we use a string variable here instead";
NSLog(stringy); //@"string" is an NSString object
int input = 0, fib = 0, bib = 1, Total = 1;
printf("How many numbers would you like to calculateHM? "); //ask user input
scanf("%d", &input); // User input stored to int!
// This loop calculates/prints the Fibonacci sequence.
for (int i = 0; i < input; i++)
{
printf("%d\n", Total);
Total = fib + bib;
fib = bib;
bib = Total;
}
[pool drain];//drains the memory pool
return 0;//program ended normally
}
I am looking to learn string manipulation, arrays, how to create your own classes, and ultimately I want to create simple GUI in an iOS.