gpt4 book ai didi

ios - UISegmentedControl - 最后一段不容易选择

转载 作者:行者123 更新时间:2023-11-29 03:56:03 27 4
gpt4 key购买 nike

所以我正在使用 UISegmented 控件,如图 enter image description here

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

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

最佳答案

要查看哪些内容可能与您的代码重叠,请添加此 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];

关于ios - UISegmentedControl - 最后一段不容易选择,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16491273/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com