How do I send the mutable string to the NSTextField properly?

Posted by Merle on Stack Overflow See other posts from Stack Overflow or by Merle
Published on 2010-04-23T03:05:06Z Indexed on 2010/04/23 3:13 UTC
Read the original article Hit count: 232

So I have all this code that I have debugged and it seems to be fine. I made a mutable string and for some reason I can not get it to be displayed on my label. the debugger says

"2010-04-22 22:50:26.126 Fibonacci[24836:10b] * -[NSTextField setString:]: unrecognized selector sent to instance 0x130150"

What is wrong with this? When I just send the string to NSLog, it comes out fine.

here's all my code, any help would be appreciated. "elementNum" is a comboBox and "display" is a Label. Thanks

 #import "Controller.h"

@implementation Controller

- (IBAction)computeNumber:(id)sender {
 int x = 1;
 int y = 1;
 NSMutableString *numbers = [[NSMutableString alloc] init];
 [numbers setString:@"1, 1,"];
 int num = [[elementNum objectValueOfSelectedItem]intValue];
 int count = 1;
 while (count<=num) {
  int z = y;
  y+=x;
  x=z;
  [numbers appendString:[NSString stringWithFormat:@" %d,", y]];
  count++;
 }
 [display setString:numbers];
 NSLog(numbers);
}
@end


`

© Stack Overflow or respective owner

Related posts about nsmutablestring

Related posts about label