objective-c – 目标C:“属性实现必须在接口中声明”

前端之家收集整理的这篇文章主要介绍了objective-c – 目标C:“属性实现必须在接口中声明”前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有以下代码

//RootViewController.h:

#import <UIKit/UIKit.h>

@interface RootViewController : UIViewController{
    IBOutlet UITextField *login_uname;
    IBOutlet UITextField *login_pword;
    IBOutlet UIActivityIndicatorView *login_thinger;
    IBOutlet UIImageView *logo;
    IBOutlet UISwitch *login_remember;

    IBOutlet UIScrollView *scrollView;
}




-(IBAction) login_submitClick:(id)sender;
-(IBAction) doneEditing:(id)sender;
-(IBAction) clearPword:(id)sender;
-(void) showSignUp:(id)sender;

-(void)dologout:(id)sender;

//for file handling:
-(NSString *)documentsPath;
-(NSString *)readFromFile:(NSString *)filePath;
-(void) writeToFile:(NSString *)text withFileName:(NSString *) filePath;

@end

//RootViewController.m

#import "RootViewController.h"
//#import "Main.h"
//#import "SignUp.h"
#import "ASIHTTPRequest.h"
#import "ASIFormDataRequest.h"
#import "CommonCrypto/CommonHMAC.h"
#import "Details.h"
//#import "signUpSMS.h"
#import "JSON.h"

@implementation PrestoCab3ViewController
@synthesize login_uname;   //this line throws the error in the title

...

我正在使用XCode 4.1并且想知道是否有人可以帮我解决这个错误底部.我对XCode很新.

提前谢谢了,

解决方法

您需要在界面中使用@property声明属性.
@property( nonatomic,retain ) IBOutlet UITextField * login_uname;

这里使用非原子,因为它是IBOutlet.另请注意,该属性具有retain修饰符,这意味着当您不再需要它时,您有责任释放该对象.

原文链接:https://www.f2er.com/c/119492.html

猜你在找的C&C++相关文章