Sending nil to CGPoint type parameter

Viewed 4873

Suppose I have this method:

- (void)placeView:(UIView*)theView withCenterIn:(CGPoint)centerPoint;

So I pass the view and a point to te the view's center.

But it happens that I do not need to specify the center, just the view.

Passing "nil" leads to error.

Please, suggest how to skip passing the center point.

Keep in mind that I need to use that method like this:

- (void)placeView:(UIView*)theView withCenterIn:(CGPoint)centerPoint{
    if(centerPoint == nil){//and I understand that it's a wrong comparison, as I cannot pass "nil" to CGPoint
        //set a random center point
    }
    else{
        //set that view to the specified point
    }
}

Thanks in advance

2 Answers
Related