Custom cells for UIPickerView with AutoLayout

For a project I needed to add a UIPickerView with custom cells using AutoLayout.  UIKit allows this via the UIPickerViewDelegate method pickerView(_:viewForRow:forComponent:reusingView).

The cell just needed an UIImageView and UILabel, so I thought it would be pretty straightforward to do, but there are some caveats you need to know. Big thanks to Tom Adriaenssen for pointing them out and not ruining my Sunday afternoon 🙂

Continue reading Custom cells for UIPickerView with AutoLayout

TNCheckBoxGroup – Custom checkboxes for Objective-C

There is now also a Swift version available: read about it here.

A few weeks back I pushed some code to GitHub to easily create checkboxes in Objective-C, but there were some limitations to the class. I’ve now updated the class so you can work with checkbox groups, like TNRadioButtonGroup.

Continue reading TNCheckBoxGroup – Custom checkboxes for Objective-C

TNCheckBox – A checkbox class for Objective-C

This class is no longer maintained…please check out TNCheckBoxGroup!

I just pushed some code to GitHub to create customisable checkboxes to use in your IOS projects.

As it happens with designers, you can’t always use the built-in UISwitch class.  So I took the time to create a few classes which are pretty customisable to have checkboxes without all the hassle.

Continue reading TNCheckBox – A checkbox class for Objective-C

Enumerate fonts on your iOS device

When you work with custom fonts in your iOS projects, you’ll need to find out the correct name for your font.

You can do this by looping though all the font families and then use the font family name to loop through all the fonts that belong to the family.

The following function will take care of this and return you a nice list ordered per font family.

- (void)enumerateFonts {
    NSLog(@"--Start enumerating font--");
    for (NSString *fontFamilyStrings in [UIFont familyNames]) {
        NSLog(@"Font family: %@", fontFamilyStrings);

        for (NSString *fontStrings in [UIFont fontNamesForFamilyName:fontFamilyStrings]) {
            NSLog(@"-- Font: %@", fontStrings);
        }
    }
    NSLog(@"--End enumerating font--");
}

I’ve also created a gist on github You can find it right here.