Skip to content

Instantly share code, notes, and snippets.

View Daniel1of1's full-sized avatar
👋

Daniel Haight Daniel1of1

👋
  • Confidence Designed London
View GitHub Profile
@Daniel1of1
Daniel1of1 / NSURLSession+DHCDirtyCoinsFix.m
Created March 14, 2014 22:12
A quick and dirty fix / fun with hopper for coins app
@interface NSURLSession (DHCDirtyCoinsFix)
//lazy way to keep compiler happy
+(void)setLoading:(BOOL)isLoading;
-(UIButton *)updateButton;
- (void)_updateTimerPaused:(BOOL)on;
@end
@implementation NSURLSession (DHCDirtyCoinsFix)
#import "NSURLSession+Swizzle.h"
#import <objc/runtime.h>
@implementation NSURLSession (Swizzle)
+ (void)load{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
Class class = self.class;
@Daniel1of1
Daniel1of1 / gist:8937116
Last active August 29, 2015 13:56
Add an accessory to cells in ABPeoplePickerNavigationController
Class ABMemberDataSourceClass = NSClassFromString(@"ABMembersDataSource");
SEL originalTableViewMethodSelector = @selector(tableView:cellForRowAtIndexPath:);
Method originalTableViewMethod = class_getInstanceMethod(ABMemberDataSourceClass, originalTableViewMethodSelector);
SEL newTableViewMethodSelector = @selector(dhc_tableView:cellForRowAtIndexPath:);
IMP newTableViewMethodImp = imp_implementationWithBlock(^UITableViewCell * (id __unused _self, UITableView *tableView, NSIndexPath *indexPath){
@Daniel1of1
Daniel1of1 / gist:8932331
Created February 11, 2014 10:16
ABPropertyPhoneNumberCell view heirarchy
<ABPropertyPhoneNumberCell: 0x111305ba0; baseClass = UITableViewCell; frame = (0 96; 320 58.5); autoresize = W; layer = <CALayer: 0x111301940>>
| <UITableViewCellScrollView: 0x111309690; frame = (0 0; 320 58.5); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0x1113099b0>; layer = <CALayer: 0x111300f40>; contentOffset: {0, 0}>
| | <UITableViewCellContentView: 0x111301ea0; frame = (0 0; 320 58.5); gestureRecognizers = <NSArray: 0x11130ead0>; layer = <CALayer: 0x1113077b0>>
| | | <UIView: 0x111305f80; frame = (0 3; 320 55); autoresize = W+H; layer = <CALayer: 0x111302390>>
| | | | <UILabel: 0x11130f170; frame = (35 9; 37 17); text = 'home'; clipsToBounds = YES; userInteractionEnabled = NO; layer = <CALayer: 0x1113023b0>>
| | | | <UILabel: 0x11130edc0; frame = (35 28; 193 21); text = '0782355'; clipsToBounds = YES; userInteractionEnabled = NO; layer = <CALayer: 0x11130ef00>>
| | | | <ABTransportButton: 0x111302a40; baseClass = UIButton;
(lldb) br s -n objc_msgSend -c 0
(lldb) c
**Do something eg. tap screen**(and wait)
(lldb) breakpoint list
//output (see 'hit count' :) )
Current breakpoints:
1: name = 'objc_msgSend', locations = 1, resolved = 1
Condition: 0