Skip to content

Instantly share code, notes, and snippets.

View timd's full-sized avatar
💭
Typing all the right things, not necessarily in the right order

Tim Duckett timd

💭
Typing all the right things, not necessarily in the right order
View GitHub Profile
@timd
timd / swipeCell.m
Created February 15, 2012 12:41
initWithStyle:reuseidentifier:
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code
// Create the top view
_topView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.contentView.frame.size.width, 80)];
[_topView setBackgroundColor:[UIColor whiteColor]];
@timd
timd / didSwipeLeftInCell.m
Created February 15, 2012 12:39
didSwipeLeftInCell:
-(IBAction)didSwipeLeftInCell:(id)sender {
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
[UIView animateWithDuration:1.0 animations:^{
[_topView setFrame:CGRectMake(-10, 0, 320, 80)];
} completion:^(BOOL finished) {
[UIView animateWithDuration:0.15 animations:^{
[_topView setFrame:CGRectMake(0, 0, 320, 80)];
}];
}];
}
@timd
timd / gist:1835386
Created February 15, 2012 12:31
didSwipeLeftInCell:
-(IBAction)didSwipeLeftInCell:(id)sender {
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
[UIView animateWithDuration:1.0 animations:^{
[_topView setFrame:CGRectMake(-10, 0, 320, 80)];
} completion:^(BOOL finished) {
[UIView animateWithDuration:0.15 animations:^{
[_topView setFrame:CGRectMake(0, 0, 320, 80)];
}];
}];
}
@timd
timd / gist:1226528
Created September 19, 2011 13:47
Extended error dump for Core Data errors
if(![managedObjectContext save:&error]) {
NSLog(@"Failed to save to data store: %@", [error localizedDescription]);
NSArray* detailedErrors = [[error userInfo] objectForKey:NSDetailedErrorsKey];
if(detailedErrors != nil && [detailedErrors count] > 0) {
for(NSError* detailedError in detailedErrors) {
NSLog(@" DetailedError: %@", [detailedError userInfo]);
}
}
else {
NSLog(@" %@", [error userInfo]);