// ViewController.h
@interface ViewController : UIViewController{
IBOutlet UIButton *btnname;
IBOutlet UITextView *txtname;
IBOutlet UILabel *lblname;
}
@property (retain, nonatomic) IBOutlet UITextField *txtname;
@property (retain, nonatomic) IBOutlet UILabel *lblname;
- (IBAction)Btntikla:(id)sender;
@end
//ViewController.m
@implementation ViewController
@synthesize txtname;//here it says -type of property txtname (uiTextView *) does not match of ivar txtname(uiTextView)- this mistakes
@synthesize lblname;
- (void)dealloc {
[lblname release];
[txtname release];
[super dealloc];
}
- (IBAction)Btntikla:(id)sender {
NSString *name=[txtname text];
lblname.text=name;
}
@end
//我的整个程序是this.it给出了这个错误?属性类型txtname(uiTextView *)与ivar txtname(uiTextView)不匹配..你能帮我吗?我的错是什么?
答案 0 :(得分:2)
那是因为你有
@property (retain, nonatomic) IBOutlet UITextField *txtname;
和
IBOutlet UITextView *txtname;
UITextField
和UITextView
是不同的控件