Do not need to initiate an object? (basic issue)
I'm doing assignment 3 that required me draw polygon shapes on a UIView.
I have PolygonShape class which describe NumberOfSides, Min-Max Sides of Polygons.
I have PolygonView.h class inherit from UIVIew:
@interface PolygonView : UIView {
IBOutlet PolygonShape *pogshape;
IBOutlet UILabel *shapelabel;
}
And Controller.m which define :
- (void) awakeFromNib{
NSLog(@"call this first");
[pogshape initWithNumberOfSides: 3 : 12 : 5];
}
Controller.h which define :
@interface Controller : NSObject{
IBOutlet PolygonShape *pogshape;
IBOutlet UILabel *nameLabel;
IBOutlet PolygonView *polyview;
}
I do not find out any "init" which allow us initiate an object. But everything go well, polygon shapes were drawed on UIView, they are changed when i indrease- decrease their numberOfSides.
I wrote :
- (void) awakeFromNib{
NSLog(@"call this first");
pogshape = [[PolygonShape alloc] init];
[pogshape initWithNumberOfSides: 3 : 12 : 5];
}
It seem to be they inititate two objects with the same name "pogshape" and there are nothing happen. Just one shape was drawed.
The question is that an object can be initiated without using "init"?
(Or explain that code)
|