嘿,我今天就开始ios编程,我正面临着这个错误。
plz帮我删除此错误
plz向我推荐了一些不错的ios开发人员教程
#import "ViewController.h"
@interface ViewController ()
@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.
}
@end
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property (weak, nonatomic) IBOutlet UITextField *txtUsername;
@property (weak, nonatomic) IBOutlet UITextField *txtPassword;
- (IBAction)loginClicked:(id)sender;
- (IBAction)backgroundClick:(id)sender;
@end
答案 0 :(得分:20)
如果您不使用ARC,则无法使用weak
。对于非ARC代码中的IBOutlet
引用,请将weak
的引用替换为retain
。 (这有点令人困惑,但通常在非ARC代码中使用assign
而不是weak
,但对于IBOutlet
引用,则使用retain
。)
更好的是,正如nneonneo建议的那样,你应该使用ARC。
答案 1 :(得分:9)
如果你刚刚开始,你应该enable ARC。它将为您节省很多麻烦,它将解决这个问题。
答案 2 :(得分:0)
您可以阅读此网页http://designthencode.com/scratch/以开始学习iOS编程。
对于为iPhone编写应用程序所涉及的许多元素,这是一个非常好的介绍。
请参阅下面的stackoverflow答案,了解您的财产申报问题。