CGRectDivide with a NULL pointer

In the following code, is it possible to get rid of a variable nothing?

CGRect startTableViewFrame;
CGRect nothing;
CGRectDivide(tableViewFrame,
             &nothing,
             &startTableViewFrame,
             searchBarHeight - contentOffset,
             CGRectMinYEdge);

NULLdoesn't seem to work. Any tips?

Thank!

+5
source share
1 answer

Ok you could do it

CGRectDivide(tableViewFrame,
             &(CGRect){},
             &startTableViewFrame,
             searchBarHeight - contentOffset,
             CGRectMinYEdge);

or even this:

MyCGRectDivide( CGRect r, CGRect * slice, CGRect * remainder, CGFloat d, CGRectEdge edge )
{
    slice = slice ? slice : &(CGRect){} ;
    remainder = remainder ? remainder : &(CGRect){} ;

    CGRectDivide( r, slice, remainder, d, edge ) ;
}
+7
source

All Articles