假设我有这个方法:
- (void)placeView:(UIView*)theView withCenterIn:(CGPoint)centerPoint;
Run Code Online (Sandbox Code Playgroud)
所以我将视图和一个点传递给视图的中心.
但碰巧我不需要指定中心,只需要指定视图.
传递"nil"会导致错误.
请建议如何跳过中心点.
请记住,我需要使用这样的方法:
- (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
}
}
Run Code Online (Sandbox Code Playgroud)
提前致谢
objective-c ×1