属性类型txtname(uiTextView *)与ivar txtname(uiTextView)不匹配

时间:2012-01-19 10:01:10

标签: iphone uitextview

    //  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)不匹配..你能帮我吗?我的错是什么?

1 个答案:

答案 0 :(得分:2)

那是因为你有

 @property (retain, nonatomic) IBOutlet UITextField *txtname;

IBOutlet UITextView *txtname;

UITextFieldUITextView是不同的控件