Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed XCode 6 compiler error #211

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
42 changes: 42 additions & 0 deletions Classes/AQGridView.m
Expand Up @@ -1223,9 +1223,51 @@ - (UIView *) _basicHitTest: (CGPoint) point withEvent: (UIEvent *) event
// UIScrollView implements _defaultHitTest:withEvent: for this, but we can't call that due to it
// being a private API.
// Instead, we have to manufacture a call to our super-super class here, grr

// XCode 6 - callimg imp(...) is throwing a compiler error 'too many arguments to function call (4, expected 0)'
/*
Method method = class_getInstanceMethod( [UIView class], @selector(hitTest:withEvent:) );
IMP imp = method_getImplementation( method );
return ( (UIView *)imp(self, @selector(hitTest:withEvent:), point, event) ); // -[UIView hitTest:withEvent:]
*/

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ddd



// Use NSInvocation to do this instead
SEL hitSelector = @selector(hitTest:withEvent:);
NSMethodSignature * signature = [self methodSignatureForSelector:hitSelector];
NSInvocation * invocation = [NSInvocation invocationWithMethodSignature:signature];


[invocation setTarget: self];
[invocation setSelector:hitSelector];

[invocation setArgument:&point atIndex:2];
[invocation setArgument:&event atIndex:3];

// Invoke!
[invocation invoke];

// Get return value
NSValue * ret_val = nil;
NSUInteger ret_size = [signature methodReturnLength];

if( ret_size > 0 ) {

void * ret_buffer = malloc( ret_size );

[invocation getReturnValue:ret_buffer];

ret_val = [NSValue valueWithBytes:ret_buffer
objCType:[signature methodReturnType]];

free(ret_buffer);
}

// Copy the value into our UIView object
UIView * returnedView = nil;
[ret_val getValue:&returnedView];

return returnedView;
}

- (BOOL) _canSelectItemContainingHitView: (UIView *) hitView
Expand Down