1.
Watched a tutorial about substrings.
Here is some code:
Now, my question is, why is the NSString object a pointer but not the NSRange object?
2.
I don't quite understand static, could someone try to explain?
3.
When I make a new file, it automatically adds the following:
Should it always look like that? With that init, and dealloc?
The way I've learnt Obj c is just simply
Is my way wrong, outdated or something?
Should I start doing it like the example code? The one that shows up when i create a new file?
4.
About objects, I do it by doing = [ [Class alloc] init ];
But I've seen other ways, like autorelease.
Should I continue with alloc, init?
5.
Autoreleasepools are only used when u initialize objects with autorelease?
And send a release message to all obejcts that use autorelease?
Something like that? Read it somewhere, always understand better when people explain to me though.
Watched a tutorial about substrings.
Here is some code:
Code:
NSString *d = @"Dont feed grapes to dogs!";
NSRange range = [d rangeOfString:@"grapes"];
2.
I don't quite understand static, could someone try to explain?
3.
When I make a new file, it automatically adds the following:
Code:
#import "testLolIgnoreMe.h"
@implementation testLolIgnoreMe
- (id)init
{
self = [super init];
if (self) {
// Initialization code here.
}
return self;
}
- (void)dealloc
{
[super dealloc];
}
//and other methods u create yourself
@end
Should it always look like that? With that init, and dealloc?
The way I've learnt Obj c is just simply
Code:
#import <Foundation/Foundation.h>
#import "FakeClass.h"
int main(int argc, const char* argv[])
{
NSAutoreleasePool *pool = [ [NSAutoreleasePool alloc] init];
FakeClass *object = [ [FakeClass alloc] init];
//do some stuff
[object release];
[pool drain];
return 0;
}
Should I start doing it like the example code? The one that shows up when i create a new file?
4.
About objects, I do it by doing = [ [Class alloc] init ];
But I've seen other ways, like autorelease.
Should I continue with alloc, init?
5.
Autoreleasepools are only used when u initialize objects with autorelease?
And send a release message to all obejcts that use autorelease?
Something like that? Read it somewhere, always understand better when people explain to me though.