Archives for posts with tag: cocoa

Update: code for the class is now on GitHub. Also updated with BSD license and a fix for the next iOS version coming soon. If you have issues please use GitHub.

The color of a UISegmentedControl in the UIKit is customizable only in the bar style mode, so if one uses the plain or bordered mode, the only possible color is blue. This could be a problem if blue does not fit well in your app or in a view.

The only way to support other colors is to subclass the UISegmentedColor and draw the view yourself. That’s what I did in the MCSegmentedControl class, here’s how it looks with a green tint color.


(more…)

In a iPhone app I’m currently developing, I have a tipical Core Data object model with two entities (called Collection and Item) in a one-to-many relationship, and two table views for the entities, the second appearing when selecting a Collection in the first. The two table views have their own controller (which implements NSFetchedResultsControllerDelegate), managed object context and NSFetchedResultsController. The second table has has a reference to the Collection object, used to build a predicate in this way:

[NSPredicate predicateWithFormat:@"collection == %@", [self.collection objectID]]

(more…)