0
이 코드에 어떤 문제가 ...NSNotificationCenter 객체 UILabel의
[[NSNotificationCenter defaultCenter] addObserver : 자기 선택기 : @ 선택기 (MySubViewNotification : 이름 : @ "MySubViewNotification"개체 : 무기 호]
-(void)MySubViewNotification:(UILabel*)GenericLabel
{
GenericLabel.textColor = [UIColor whiteColor]; ---- Error ----
GenericLabel.text = @"cwxcwxc"; ---- Error ----
NSLog(@"%@", GenericLabel);
}
NSLog.
NSConcreteNotification 0x1759c6c0 {name = MySubViewNotification; object = <UILabel: 0x175aace0; frame = (175 5; 62 15); text = '1.35'; clipsToBounds = YES; opaque = NO; autoresize = RM+BM; userInteractionEnabled = NO; layer = <CALayer: 0x175aad80>>}
Errror
-[NSConcreteNotification setText:]: unrecognized selector sent to instance 0x165a4270
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSConcreteNotification setText:]: unrecognized selector sent to instance 0x165a4270'
감사하지만 알림 추가 오류가 발생했습니다. [NSNotificationCenter defaultCenter] addObserver : 셀렉터 : @selector (MySubViewNotification :) name : @ "MySubViewNotification"object : nil]; – Alan10977
귀하의 의견을 이해할 수 없습니다. – Wain
알림을 만들 때 [[NSNotificationCenter defaultCenter] addObserver : 셀렉터 : @selector (MySubViewNotification :) 이름 : @ "MySubViewNotification"개체 : nil]; 난 캐치되지 않은 예외 'NSInvalidArgumentException'으로 인해 응용 프로그램을 종료했습니다 이유 - '[MasterViewController MySubViewNotification :] : 인식 할 수없는 선택기가 인스턴스 0x15d4bcf0로 전송 됨' – Alan10977