【发布时间】:2011-01-23 19:32:00
【问题描述】:
我在 .h 中声明了这个
IBOutlet UILabel *display;
在 .m 中,我正在执行以下操作,但它不起作用,一直说 displat.text 为空。困惑,求助!是的,我是菜鸟。
NSLog(@"operation button pressed %@ is of class %@",[[sender titleLabel] text],[[[sender titleLabel] text] class] );
NSString *operation = [[sender titleLabel] text];
[display setText:operation];
NSLog(@"display text is of class %@ and equals %@",[display.text class], [display text]);
我也试过这样:
NSLog(@"digit button pressed %@ is of class %@",[sender currentTitle],[[sender currentTitle] class] );
display.text = (NSString *)[[sender titleLabel] text];
NSLog(@"display text is of class %@ and equals %@",[display.text class], [display text]);
【问题讨论】:
-
你有 NSLog() 语句散布在这里和那里......你的运行日志中的输出是什么?
标签: iphone cocoa uibutton uilabel