UITextField rightView “WhileEditing” problem
I try to subclass UITextField as follows to implement custom rightView as a Clear button: -(void) drawRect:(CGRect)rect { [self.layer setBackgroundColor:[[UIColor colorWithRed:20.0/255.0 green:20.0/255.0 blue:20.0/255.0 alpha:1] CGColor]]; [self.layer setCornerRadius:15.0]; UIImage *imgClear = [UIImage imageNamed:@"btnClear"]; CGSize iSize = [imgClear size]; UIButton *clearButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, iSize.width, iSize.height)]; [clearButton setImage:imgClear forState:UIControlStateNormal]; [clearButton addTarget:self action:@selector(clearText:) forControlEvents