开发者

Can a UIView be a UITextField Delegate

开发者 https://www.devze.com 2023-02-18 17:09 出处:网络
I am getting a sigabrt error when I try to set the delegate of my UITextField to my UIView class. I have used the UITextFieldDelgate Protocal. here is my code

I am getting a sigabrt error when I try to set the delegate of my UITextField to my UIView class. I have used the UITextFieldDelgate Protocal. here is my code

    nameField = [[UILabel alloc] initWithFrame:CGRectMake(130, 40, 200, 30)];
    [nameField setDelegate:self];
    nameField.placeholder = @"<Game Name>";
    nameField.textAlignment = UITe开发者_如何学运维xtAlignmentCenter;
    [self addSubview:nameField];


You are about to use UITextField in constructor, not UILabel. Replace your first string with the following:

nameField = [[UITextField alloc] initWithFrame:CGRectMake(130, 40, 200, 30)];
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号