UIView的Text属性调用不出来
// .h 文件
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property (strong, nonatomic) IBOutlet UIView *userInput;
@property (strong, nonatomic) IBOutlet UIView *userOutput;
- (IBAction)setOutput:(id)sender;
@end
//.m文件
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
@synthesize userOutput;
@synthesize userInput;
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)viewDidUnload {
self.userInput = nil;
self.userOutput = nil;
[self setUserInput:nil];
[self setUserOutput:nil];
[super viewDidUnload];
}
- (IBAction)setOutput:(id)sender
{
self.userOutput.text;//提示:Propety"text"not found on object of type"UIview"
self.userInput.textInputContextIdentifier;// 只有这个属性是返回NSString的
}
@end
如上述代码。UIView的对象 userinput.text会是错的,我是按照教程写的代码啊