내 SomeClass.hViewController에서 하위 클래스의 메서드에 열거 형을 전달하는 방법은 무엇입니까? 캐스트없이 정수의 포인터를 만드는 :
typedef enum thing {stuff, foo, bar, etc} thing;
@interface SomeClass : UIView {
NSNumber *aNumber;
thing aThing;
}
내 SomethingViewController.m는
-(void)doSomething:(NSNumber *)n
withThing:(id)t
{
SomeClass *class = [[SomeClass alloc] initWithFrame:aRect];
[class setAThing:(thing)t];
[class setANumber:n];
}
-(void)viewDidLoad
{
[self doSomething:[NSNumber numberWithInt:2] withThing:foo];
이것은 withThing에 대한 경고 제외하고, 잘 작동하는 것 같다.
제 질문은 다음과 같습니다. 나에게이 경고를주지 않는 다른 방법이 있습니까?
감사! 이것은 도움이되었습니다. –