CGPoint is a C struct , you cannot pass nil for it. You can create a separate method that does not accept unnecessary CGPoint and get rid of your if , for example:
- (void)placeView:(UIView*)theView withCenterIn:(CGPoint)centerPoint{
If you insist on keeping one method, you can designate one point as βspecialβ (say, CGMakePoint(CGFLOAT_MAX, CGFLOAT_MAX) ), wrap it in #define and use nil instead.
Another solution is to wrap your CGPoint in NSValue :
NSValue *v = [NSValue withPoint:CGMakePoint(12, 34)]; CGPoint p = [v pointValue];
source share