Hey guys,
I really feel like I am drawing a blank over something very obvious, but I've been stuck for some time.
Say I have a class:
With appropriate getters and setters. Now hardcoding a "person" is hella simple. But I need the user to be able to create new instances of the person class. I feel like this would be easier in java since I have a better understanding of constructors in java.
How I assume it would go, is that I could have the user fill in various text fields of the desired input, and then on button click fill a constructor with said data. But I don't see where I will [alloc] the data.
By just using the getters and setter I can do this easily, as long as I have already hard coded the initiation of the class.
IE:
And then filling the rest via button click and such.
Can someone tell me how to let the user create the whole thing?
Thanks
I really feel like I am drawing a blank over something very obvious, but I've been stuck for some time.
Say I have a class:
Code:
#import <Foundation/Foundation.h>
@interface Person : NSObject
{
NSString *name;
NSInteger *age;
NSInteger *weight;
}
@end
How I assume it would go, is that I could have the user fill in various text fields of the desired input, and then on button click fill a constructor with said data. But I don't see where I will [alloc] the data.
By just using the getters and setter I can do this easily, as long as I have already hard coded the initiation of the class.
IE:
Code:
Person *Mike = [[Person alloc]init];
Can someone tell me how to let the user create the whole thing?
Thanks