What exactly happening here is, When you are changing the title of button, the text becomes out of bound.
What you can do is, programmatically set the button size to fit its content/title.
For that use this:
NSString *btnGetRegisterCodeTitle = NSLocalizedString(@"Get Registration Code", @"Title on button");
[_btnRegister setTitle:btnGetRegisterCodeTitle forState:UIControlStateNormal];
[_btnRegister sizeToFit];
Here the sizeToFit method will automatically resize your UIButton in such a way that your Title is not merged/overlapped.. :)
Update:
Have a look at this Question
I've copied the selected answer from there, in case that question is removed..
Check out the NSString method -sizeWithFont:. It returns a CGSize that will inform you as to how much size your text will need in the button. Then you can adjust the button's frame based on this size, adding whatever padding you desire to the width and height of the button's frame. Something like this:
NSString *msg = @"The button label";
UIFont *font = [UIFont systemFontOfSize:17];
CGSize msgSize = [msg sizeWithFont:font];
CGRect frame = button.frame;
frame.size.width = msg.size.width+10;
frame.size.height = msg.size.height+10;
button.frame = frame;