gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 21:04:24 24 4
gpt4 key购买 nike

    //  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

//我的整个程序是这样的。它给出了这个错误?属性txtname(uiTextView *)的类型与ivar txtname(uiTextView)不匹配。您能帮我吗?我的错误是什么?

最佳答案

那是因为你有

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

IBOutlet UITextView *txtname;

并且 UITextFieldUITextView 是不同的控件

关于iphone - 属性 txtname (uiTextView *) 的类型与 ivar txtname(uiTextView) 不匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8924087/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com