Search code examples
iosuiviewdrawrectcs193pcgcontextref

Need clarifications working with Views in iOS


Ok, I'm learning programming for iOS with Stanford's online course on iTunes U (CS193P) but I can't exactly get a hold on how all the stuff from UIView works.

Could someone explain how the following things work cohesively and how I should use them?

CGContextRef CGContext(if they're not the same thing) drawRect awakeFromNib

Thanks in advance!


Solution

  • CGContextRef 
    

    is just the reference to

    CGContext.

    drawRect 
    

    makes your view to draw (or redraw) itself at selected rect. Read here. I never used it by myself, for me it was enough to do all work in viewWillAppear: and viewDidLoad:.

    After all outlets and actions are connected, the nib loader sends awakeFromNib to every object in the nib. (c) Read about it here.