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:self selector:@selector(MySubViewNotification :) name:@「MySubViewNotification」object:nil]; – Alan10977
我不明白你的意見。 – Wain
當我創建我的通知時,[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(MySubViewNotification :) name:@「MySubViewNotification」object:nil];我有***終止應用程序由於未捕獲的異常'NSInvalidArgumentException',原因:' - [MasterViewController MySubViewNotification:]:無法識別的選擇器發送到實例0x15d4bcf0' – Alan10977