"addImageButton" here is my UIButton, and I use the line of code below to create a border for the button.
[addImageButton.layer setBorderWidth:5]; [addImageButton.layer setBorderColor:[[UIColor redColor] CGColor]]; [addImageButton setTintColor:[UIColor whiteColor]]; [addImageButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];

Hope this solves your problem.
source share