0

I am refering a tutorial from raywenderlich.all thins work perfectly , but in the last where i am customizing my text field,the tutorial says "Replace the call to super with the following code"

- (void)drawRect:(CGRect)rect
{
    UIImage *textFieldBackground = [[UIImage imageNamed:@"text_field_teal.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(15.0, 5.0, 15.0, 5.0)];
    [textFieldBackground drawInRect:[self bounds]];
}

but it didn't said where to put it, i have tried to put it in appdelegate and also in viewcontroller but it display error "no visible @interface for 'detailviewcontoller' declare the selector bounds".

1 Answers1

0

The normal thing for iOS programmers to do here is to subclass "UITextView", and that's what the tutorial did. If you look in the project included with Ray's tutorial, you'll see a "Custom Views" group and inside there you'll see a "CustomTextField" class.

Custom Text Field is here

In there you'll find the "drawRect" method to update.

Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215