Take the 2-minute tour ×

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];
share|improve this question
IMPROVE YOUR ACCEPT RATE! Mark suitable answer with checkmark (under the number with arrows left to the text) in all your questions that have been answered! –  NR4TR Mar 20 '11 at 12:45

1 Answer 1

up vote 2 down vote accepted

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)];
share|improve this answer

Your Answer


