Skip to content

Instantly share code, notes, and snippets.

@calebhicks
calebhicks / parentTableView
Created July 23, 2014 19:34
Parent Table View of Custom TableViewCell
-(UITableView *) parentTableView {
// iterate up the view hierarchy to find the table containing this cell/view
UIView *aView = self.superview;
while(aView != nil) {
if([aView isKindOfClass:[UITableView class]]) {
return (UITableView *)aView;
}
aView = aView.superview;
}
@calebhicks
calebhicks / Fetched Results Controller
Created July 23, 2014 01:36
Fetched Results Controller Boilerplate
- (NSFetchedResultsController *)fetchedResultsController
{
if (_fetchedResultsController != nil)
{
return _fetchedResultsController;
}
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Tag" inManagedObjectContext:[CoreDataHelper sharedInstance].managedObjectContext];
[fetchRequest setEntity:entity];
@calebhicks
calebhicks / CoreDataHelper.m
Last active March 22, 2016 02:40
Core Data Helper
//
// CoreDataHelper.m
// Wired In
//
// Created by Caleb Hicks on 6/20/14.
//
// Readme: I use a version of this file in each Core Data project I create. It runs as a Shared Instance.
// Simply, it returns the default Managed Object Context for the app. Sample methods also provided to save, create sample
// data, and log all data within the app. Adjust the Imports and related methods for your model objects.
//