检查UITextInteractionAssistant类

时间:2015-01-15 03:17:46

标签: ios objective-c uiview uigesturerecognizer

我试图在我的视图中控制手势识别器。

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
    NSMutableArray *targets = [gestureRecognizer valueForKeyPath:@"_targets"];
    id targetContainer = targets[0];//get first target for example
    id targetOfMyGes = [targetContainer valueForKeyPath:@"_target"];

    NSMutableArray *targets1 = [otherGestureRecognizer valueForKeyPath:@"_targets"];
    id targetContainer1 = targets1[0];//get first target for example
    id targetOfOtherGes = [targetContainer1 valueForKeyPath:@"_target"];

    if ([targetOfMyGes isKindOfClass:[UITextView class]] || [targetOfOtherGes isKindOfClass:[UITextView class]])
    {

    }

}

当我调试时,targetOfOtherGes是这样的。

(lldb) po targetOfOtherGes
<UITextInteractionAssistant: 0x194afdd0>

我需要检查targetOfOtherGes是否是UITextInteractionAssistant的类。但是,当我检查时,我得到了这样的错误。它说前进声明。所以,我需要导入.h文件。但是,我应导入哪个文件?

enter image description here

1 个答案:

答案 0 :(得分:0)

这是part of UIKit。如果它没有显示为有效,则可能是因为Apple不希望您访问它。

这有点笨拙,但我通过这样的事情解决了与UISegment类似的问题:

// the class definition in some header
@interface FakeSegment : UIView

@property (nonatomic, strong) id label;

@end

// how the fake definition can be used to get what you want
NSString* typeName = NSStringFromClass([segment class]);
if ([typeName isEqualToString:@"UISegment"]) {
    UILabel *label = ((FakeSegment *)segment).label;
}