나는 그런 식으로 정의 지정된 초기화와 클래스를 만들었습니다 initWithFrame 정의에서 예외를 throw하는 것에 대해 :지정 초기화 및 initWithFrame
- (id)initWithFrame:(CGRect)frame
{
@throw ([NSException exceptionWithName:@"InitError"
reason:@"This class needs to be initialized with initWithFrame:aProperty: method"
userInfo:nil]);
}
이 방법이 좋은 해결책입니까?
이 간단한 좋은 해결책 : – MatterGoal
네, 그리고 그건 그냥'initWithFrame 호출하는 코드를 중단하지 않습니다'aProperty''에 대한 좋은 기본값은 무엇을 알고하지 않음으로써. 그리고 나중에 'aProperty'를 변경할 수있게되면 눈에 띄지 않습니다. – Cyrille