Skip to content

Commit

Permalink
feat: 指令生成兼容UIButton仅作为提供触控能力的工具控件的场景。
Browse files Browse the repository at this point in the history
  • Loading branch information
Hulk committed May 18, 2022
1 parent 7c53a5c commit e34301e
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ + (NSString*)getViewContentOfControl:(UIControl*)control {
// 获取有代表性的内容便于更好的定位view
viewContent = [PrismInstructionContentUtil getRepresentativeContentOfView:control needRecursive:YES];
}
// 兜底考虑把UIButton仅作为给父View添加触控能力的工具控件的场景(此时UIButton通常就是个空白按钮),此时向上遍历真正有意义的父级View。
if (!viewContent.length && [control isKindOfClass:[UIButton class]]) {
UIView *superView = control.superview;
if (superView && CGRectEqualToRect(control.frame, superView.bounds)) {
viewContent = [PrismInstructionContentUtil getRepresentativeContentOfView:superView needRecursive:YES];
}
}
return viewContent;
}

Expand All @@ -70,7 +77,7 @@ + (NSString*)getViewContentOfButton:(UIButton*)button {
else if (button.titleLabel.attributedText.length) {
return [NSString stringWithFormat:@"%@%@", kViewRepresentativeContentTypeText, button.titleLabel.attributedText.string];
}
else if (button.imageView.image) {
else if (button.imageView.image && button.imageView.image.prismAutoDotImageName.length) {
return [NSString stringWithFormat:@"%@%@", kViewRepresentativeContentTypeLocalImage, button.imageView.image.prismAutoDotImageName];
}
return nil;
Expand Down

0 comments on commit e34301e

Please sign in to comment.