1

I am having trouble at the moment fully understanding how to use PaintCode for the first time.

I created my UI in PaintCode and converted it into Objective C code using StyleKit. So it generated a Special.h and Special.m file which I imported into the project and I also added a .pch file up top as per recommendations to save time importing the files into all the relevant classes, etc.

After importing the two Special files for this class, I then added a new view class with SpecialView.h and SpecialView.m files in order to call drawRect: and draw the view. The generated Special class has the code for the UI. Then I added a UIView item to the storyboard. I am getting something on screen but just wondering if I have done this correctly?

Here is my code for the view class:

#import "SpecialView.h"


@implementation SpecialView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
    }
    return self;
}



- (void)drawRect:(CGRect)rect
{
    [Special drawDrawPaintcode];
}

@end

Have I missed anything? I mean I am getting the rectangle I want when I run it in the simulator but I don't have any code in the view controller yet. How is this running without the controller having a link to this draw code? It is just in the view classes.

hinterbu
  • 747
  • 2
  • 7
  • 12
  • The view is responsible for drawing, you did everyone right :) somewhere (either in the view controller or the storyboard) you instantiated a class of this view (or in the ne storyboard set the view to be of class `SpecialView`. That's all there is to do :) – HAS Mar 11 '17 at 15:39

0 Answers0