objective c - iPhone Rendering Question -


I'm new to the iPhone / Objective-C development I read a few chapters of "jumping the gun" and Aurelie iPhone development And started implementing. I was following the ebook code and create my code following error:

  CGContextSetFillColorWithColor: Invalid reference CGContextFillRects: Invalid reference CGContextSetFillColorWithColor: Invalid reference CGContextGetShouldSmoothFonts: Invalid references  
.

However, when I did download the sample code chapters address different

Book code:

  - (minus) presented {CGContextRef G = UIGraphicsGetCurrentContext ( ); // Fill the background with Gray CGContextSetFillColorWithColor (G, [UIColor Gray Color] .CGColor); CGContextFillRect (G, CGRectMake (0, 0, self.fram.ize.width, self.frame.size.height)); // Insert text in black CGContextSetFillColorWithColor (G, [UIColor blackColor] .CGColor); [@ "O Reilly Rule!" Draattpoint: Sijeepivontemek (10.0, 20.0) with fonts: [Uaifoti Prnalifontof Size: [Uaiafont Sistmfontsijh]]]; }  

The actual project code from the website (works):

  - (zero) submission {{self setNeedsDisplay]; // Attract to set it a deferred call. } - (Zero) Direct: (CGRTact) rect {CGContextRef g = UIGraphicsGetCurrentContext (); // Fill the background with Gray CGContextSetFillColorWithColor (G, [UIColor Gray Color] .CGColor); CGContextFillRect (G, CGRectMake (0, 0, self.fram.ize.width, self.frame.size.height)); // Insert text in black CGContextSetFillColorWithColor (G, [UIColor blackColor] .CGColor); [@ "O Reilly Rule!" DrawPoint: CGPWindMake (10.0, 20.0) with fonts: [UIFont SystemFontoffs: [UIFont SystemFontsS]]]; }  

Is it about making these lines of code that the application is rendered correctly

  - (zero) submission {{self setNeedsDisplay} ]; // Attract to set it a deferred call. } - (void) drawRect: (CGRect) rect { 

Thanks in advance for helping novice

When you attract things to the screen, you need a graphics reference (which I'm sure you have read all), but it is only provided (more or more) Less) when cocoa -drawRect call:, then your options are basically only -drawRect:, which you do, or for -Render system that you want What are trying are presented do not make much sense to look at the phone to capture your view, which is why the system (finally) a graphics context will create and respective drawRect: call, which should be the real drawing code. Otherwise, there will be no graphics context, so I think what your errors are saying.

(Note: The above system means the UIKit as the OS does)


Comments