문제

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 = UITextAlignmentCenter;
    [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)];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top