1

I'm a total beginner at iPhone development so I have a little question:

This is my viewcontroller.m

//
//  ViewController.m
//  Conversie talstelsels
//
//  Created by Stijn Hoste on 16/11/12.
//  Copyright (c) 2012 Stijn Hoste. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
@synthesize lblOct;

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)txtGetal:(id)sender {

  lblOct.text = @"derp";


}
@end

This is my viewcontroller.h

//
//  ViewController.h
//  Conversie talstelsels
//
//  Created by Stijn Hoste on 16/11/12.
//  Copyright (c) 2012 Stijn Hoste. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController
- (IBAction)txtGetal:(id)sender;
@property (weak, nonatomic) IBOutlet UILabel *lblDec;
@property (weak, nonatomic) IBOutlet UILabel *lblOct;
@property (weak, nonatomic) IBOutlet UILabel *lblHex;

@end

So when I try to do this: @synthesize lblOct; It gives me the following error: illegal interface qualifier When I try to do this: lblOct.text = @"derp"; It gives me this error: use of undeclared identifier 'lblOct', did you mean '_lblOct'?

Can somebody help me with this probably easy problem?

Thanks in advance!

4

2 回答 2

0

你应该使用

self.lblOct.text = @"text";
// or
_lblOct.text = @"text";

Xcode4.4(LLVM 4.0 编译器)或更新版本中,如果您不添加@synthesizeXcode 将添加一个默认值,例如

@synthesize variable = _variable;
于 2012-11-17T08:17:27.870 回答
0

尝试使用self.lblOct = @"text";

此外,使用新的 XCode,您不再需要使用@synthesize,因此只需省略它即可。

于 2012-11-16T22:15:36.370 回答