Pregunta

en mi archivo .h que tengo:

    #import <UIKit/UIKit.h>


@interface untitled : UIViewController 
{
    NSMutableString * sResults;
}

@property (nonatomic,retain) NSMutableString * sResults;

@end

En mi .m tengo:

#import "untitled.h"


@implementation untitled

@synthesize sResults;

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
    sResults = [[NSMutableString alloc] initWithString:@"Hello"];
    [sResults appendString:@" World"];
}

@end

Siempre que puedo comprobar sResults dice "Fuera de alcance" .. ¿qué estoy haciendo mal?

¿Fue útil?

Solución

Prueba esto:

- (void)viewDidLoad {
    [super viewDidLoad];
    self.sResults = [NSMutableString stringWithString:@"Hello"]; //retained in synthesized setter
    [self.sResults appendString:@" World"];
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top