TUTORIAL: Using UICollectionView with UICollectionViewFlowLayout

Showing data in a gridview is a beautiful and space-saving solution for graphical data (e.g movies, books, pictures etc). It has been popular long before Apple introduced UICollectionView in iOS 6 – a powerful and highly customisable way

TUTORIAL: Creating custom layouts for UICollectionView

In the previous part of this tutorial, basic usage of UICollectionViewFlowLayout was discussed.  UICollectionViewFlowLayout is a powerful and convenient way to create beautiful collections, but sometimes a more sophisticated approach is needed. This tutorial will show, how

A Quick tip: Adding and removing NSNotificationCenter observers in UIView subclass

It is sometimes needed for a UIView subclass to register as an NSNotificationCenter observer. However, there seems to be no good place for adding/removing NSNotificationCenter observers… The best place, I have found so far, is in willMoveToWindow: and didMoveToWindow

How to detect a jailbroken device programmatically?

Why is it necessary to detect a jailbroken device? Sometimes it’s necessary to restrict iOS app to run only on non-jailbroken devices. For example, it might be useful for media applications to make content piracy more difficult

How to use NSLog and print only for debugging?

Why NSLog and print are dangerous? Using NSLog and print are very popular logging mechanisms in iOS applications. However, in most cases logging to standard output is useful only for debugging applications and is useless in the released application.

UIPageViewController: how to get current page index and current visible controller?

UIPageViewController has the viewControllers array property. The currently visible viewController is always the first one in the viewControllers array. Example: Objective-C: Swift: The easiest way to get the current index is to have the itemIndex property in every content controller and just retrieve its

Comparison of system fonts on iOS 8 and iOS 9

Background Until iOS 9 the well known system font for apps was Helvetica Neue. In iOS 9 Apple changed the default font to San Francisco. For developers it’s not a big issue as long as system fonts

Private iOS API: Toggle location services programmatically

Use this snippet to toggle location services on your device programmatically. Snippet: Required entitlements: com.apple.locationd.authorizeapplications is required Download the example entitlement file from here: location.entitlements Compatibility: Confirmed working on jailbroken iOS 9.0  

Private iOS API: Toggle mobile data programmatically

Use this snippet to toggle mobile (cellular) data on your device programmatically. Snippet: Required entitlements: This requires com.apple.CommCenter.fine-grained entitlement on iOS 8.3+. Works without entitlement on iOS 8.1.2. Download the example entitlement file from here: cellular.entitlements Compatibility: Confirmed working on

Jailbreak development: Toggle airplane mode programmatically

There’re plenty of iOS development materials online, but not that much information regarding iOS jailbreak development. Therefore, I’m gonna share a bunch of code snippets to solve simple tasks in jailbreak development that I found myself useful