So I have a custom clearButton for my generic UITextField. I am trying to move the clearButton as the background of my uitextfield has some design stuff on the right side. I need the clear button to be pushed over about 150 pixels.
I tried all combinations of this but it ends up pushing the clearbutton off screen or makes the clear button really wide so the text in the uitextfield stops way to short.
1st try
UIButton *clearBtn = [UIButton buttonWithType:UIButtonTypeCustom];
CGRect rect;
UIEdgeInsets contentInsets;
CGRect result;
[clearBtn setImage:[UIImage imageNamed:@"design.png"] forState:UIControlStateNormal];
rect = CGRectMake(0, 0, 45, 45);
contentInsets = UIEdgeInsetsMake(0, 50, 0, 0);
result = UIEdgeInsetsInsetRect(rect, contentInsets);
[clearBtn setFrame:result];
2nd try
UIButton *clearBtn = [UIButton buttonWithType:UIButtonTypeCustom];
CGRect rect;
UIEdgeInsets contentInsets;
CGRect result;
[clearBtn setImage:[UIImage imageNamed:@"design.png"] forState:UIControlStateNormal];
rect = CGRectMake(0, 0, 45, 45);
contentInsets = UIEdgeInsetsMake(0, 250, 0, 150);
result = UIEdgeInsetsInsetRect(rect, contentInsets);
[clearBtn setFrame:result];