home *** CD-ROM | disk | FTP | other *** search
- Objective:
-
- Learn how to use the "newFrame" method to run initialization code in
- a view object.
-
- Terms:
-
- Discussion:
- This is used to set up initial coordinates and do initial drawing.
-
- Method:
-
- Create a sub-class of view called PieView. Take the "slider" code and
- add the following sections to the PieView.m file:
-
- +newFrame:(const NXRect *)tF
- {
- float c_x, c_y; // X and Y center of view
- // we are using the Appkit "newFrame" plus our own additions
- self = [super newFrame:tF];
- c_x = bounds.size.width/2.0;
- c_y = bounds.size.height/2.0;
- [self translate:c_x :c_y];
- [self scale:1.0 :-1.0];
- myLabel = "";
- return self;
- }
-
- Also add the following line to the myView.h file:
-
- + newFrame:(const NXRect *)tF;
-
- Further Questions:
-
- Summary:
- You now can initialize views just the way you initialized objects.
-
-