Pregunta

Tengo el siguiente código:

- (void)drawRect:(NSRect)dirtyRect 
{
   [[NSBezierPath bezierPathWithOvalInRect:[self theRect]] stroke];
}

- (NSRect)theRect
{
   return NSMakeRect(1, 1, 1, 1); // made up some values
}

Cuando compilo dice "Tipo incompatible para el argumento 1 de error 'bezierPathWithOvalInRect'". Cuando hago esto, sin embargo, funciona:

- (void)drawRect:(NSRect)dirtyRect 
{
   NSRect theRect = NSMakeRect(1, 1, 1, 1);
   [[NSBezierPath bezierPathWithOvalInRect:theRect] stroke];
}

¿Cuál es el problema?

Gracias.

¿Fue útil?

Solución

¿Se puso - (NSRect)theRect en su cabecera?

También es lo que dice el programa podría no responder a -theRect?

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top