A common scenario in iOS development is to create a textfield that will only allow a certain number of characters to be entered. We can implement this constraint by: - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { BO…
#ui
22 posts with this tag
When I wanted to add a Done/Next key to the keyboard I found it surprisingly hard to find out how this was possible. After much research I stumbled upon the solutions that you go through the textfield to set the button. Done - (void)textFieldDidBeginEditing:(UITextField *)textField { textFiel…
Recently I was asked to add a pale (off-white) color as the background color of a navigation bar, which I thought would just be a case of updating the tintColor property . However when I did this instead of getting the gradient effect that we were after all I ended up with was a solid off-white col…
Working in a team, I often find myself trying to avoid using Interface Builder (IB) as much as possible. This is because trying to resolve the inevitable conflicts that arise when two developers change the same xib can be soul-destroying ⚰️. A sea of seemingly unrelated xml changes awaits anyone wh…
I use the below category when working with dynamic content. It has useful methods for setting up a UILabel frame based upon its content and restrictions that you place on it. .h @interface UILabel(Size) /* @method Adjusts UILabel's frame to begin at defined x and y position and have a dynam…
I sometimes find myself creating applications that have a Home viewcontroller and all other views should allow the user to directly return to this Home viewcontroller. I don't just want to push a fresh copy of the Home viewcontroller on the navigation stack. Instead, I need to loop through the n…
A common want in any application that communicates with a web service is to add a loading/loader view to show your user that the application is busy getting data and has not crashed. I've came up with a generic loading view that I use on multiple applications, its split into two methods, one to…
Adding search functionality to your UITableView can be achieved using the built in UISearchBar object and implementing the UISearchBarDelegate protocol. I am going to take us through an example that searches an Article instances (data object) properties for the users entered search string, displayin…
Recently on an application I came across an issue where when I showed a UIPickerView inside an action sheet the bottom half(ish) of the pickerview wasn't selectable. I had came across this before when showing buttons in an UIActionSheet and had overcome it by moving the button slightly higher…