Skip to main content

Objc.io

There is so much information and learning material available now that it is sometimes hard to know where to start or what is the best place to go especially if you are just starting out or moving onto the next level. Well for me the place I always go to first and keep returning to […]

Read More

UIView UITapGestureRecognizer

Adding a UITapGestureRecognizer to a UIView is very straighforward. All you do is setup the gesture and then assign it to the view. Could not be much easier could it.

There are a couple of points just to hightlight. Firstly if you are using a UIImageView then you will need to add in the […]

Read More

UIPopoverController height

A recent project I worked on required a number of UIPopoverController screens. The api allows the implementation of these very easily in just a couple of lines as below:

Here i create a UIPopoverController when a button is pressed,  using the sender button to presentPopoverFromRect. But what if you want to amend the size […]

Read More

Empty Table View Cells

Let’s imagine you have setup your UITableView and populated its cells. Things are looking good but there are empty cells after your content has finished? Well, there is an easy way to hide those empty cells. Simply enter the following into ViewDidLoad() if you are using a UITableViewController or if your creating a UITableView then […]

Read More

UITableView willDisplayHeaderView

To amend the header section display in terms of colours for example on a uitableview you can utilise the UITableView Delegate protocol of  tableView:willDisplayHeaderView:forSection: You can alter the background colour using the view tintColor and then by accessing the view you can amend the header text label.

You can apply different styles for different section headers using the […]

Read More

UICollectionView Spacing

There are a few aspects to handling spacing and size of UICollectionViews and their cells. Lets start with the spacing around the actual uicollectionview. To do this we effectively add padding or edge insets. You can add edges to all sides of the collection view.

Now what about the cells within the UICollectionView. We can set […]

Read More

UICollectionViewCell Segue

When using a UICollectionView, you may want to pass data from one controller to another when a user clicks on the collection view cells. In order to do this, we need to find the item that has been clicked on. With the uicollectionview and segue setup within the storyboard, you can use the prepareForSegue function […]

Read More

Change UITabBar Height

If you need to amend the UITabBar in order to fit your layout or design perfectly, a common place to start is with the height. A quick and simple way I have been able to change the height is to subclass the UITabBar and then override the sizeThatFits(size: CGSize) function. If you are using Storyboards, you can […]

Read More