0

所以我正在使用 UISegmented 控件,如图所示在此处输入图像描述

最后一段“5”很难用我的手指敲击。我从使用光标的模拟器中注意到,只有大约一半的段会响应。半场右侧的任何东西基本上都是死区。我不确定是什么原因造成的,因为我已将此分段控件移到顶部,但它仍然做同样的事情。但是,如果我将分段控件移动到屏幕中心,则 5 Segment 整个表面区域会响应触摸事件......

我不知道如何解决这个问题。

4

1 回答 1

1

要查看可能与您的代码重叠的内容,请添加此 UIVIew 类别:

@interface UIView (Dumper_Private)

+ (void)appendView:(UIView *)v toStr:(NSMutableString *)str;

@end

@implementation UIView (Dumper_Private)

+ (void)appendView:(UIView *)a toStr:(NSMutableString *)str
{
    [str appendFormat:@"  %@: frame=%@ bounds=%@ layerFrame=%@ tag=%d userInteraction=%d alpha=%f hidden=%d\n", 
        NSStringFromClass([a class]),
        NSStringFromCGRect(a.frame),
        NSStringFromCGRect(a.bounds),
        NSStringFromCGRect(a.layer.frame),
        a.tag, 
        a.userInteractionEnabled,
        a.alpha,
        a.isHidden
        ];
}

@end

@implementation UIView (Dumper)

+ (void)dumpSuperviews:(UIView *)v msg:(NSString *)msg
{
    NSMutableString *str = [NSMutableString stringWithCapacity:256];

    while(v) {
        [self appendView:v toStr:str];
        v = v.superview;
    }
    [str appendString:@"\n"];

    NSLog(@"%@:\n%@", msg, str);
}

+ (void)dumpSubviews:(UIView *)v msg:(NSString *)msg
{
    NSMutableString *str = [NSMutableString stringWithCapacity:256];

    if(v) [self appendView:v toStr:str];
    for(UIView *a in v.subviews) {
        [self appendView:a toStr:str];
    }
    [str appendString:@"\n"];

    NSLog(@"%@:\n%@", msg, str);
}

@end

并打电话[UIView dumpSuperviews:theSegmentedControl];

于 2013-05-10T21:54:22.317 回答