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

标签是如何添加的? #7

Closed
FMYang opened this Issue Aug 27, 2018 · 7 comments

Comments

Projects
None yet
2 participants
@FMYang
Copy link

FMYang commented Aug 27, 2018

accessibilityIdentifier是在长按某个视图的时候,给这个视图添加的吗?还是程序启动后,给所有视图自动添加的?
如果是长按的时候添加的话,如果所有的视图都需要标签,得全部长按一遍吗?
目前只看到设置imageName的时候,自动添加了accessibilityIdentifier,期待解答。

+ (UIImage *)tb_imageNamed:(NSString *)imageName{
    UIImage *image = [UIImage tb_imageNamed:imageName];
    image.accessibilityIdentifier = imageName;
    return image;
}
@yulingtianxia

This comment has been minimized.

Copy link
Owner

yulingtianxia commented Aug 28, 2018

@FMYang 标签是懒加载的,只有你需要用到的时候,才会生成。不是启动后给所有视图都加一遍标签。

@FMYang

This comment has been minimized.

Copy link
Author

FMYang commented Aug 28, 2018

@yulingtianxia

 if ([name hasPrefix:@"_"]) {  //去掉变量名的下划线前缀
        name = [name substringFromIndex:1];
   }

swift4.2中变量名是以 .storage结尾的,不是‘_’开头的,截取下划线的方式获取变量名不适用于swift

一开始以为是自动打标签的,这样使用Appium等自动化测试工具编写脚本就方便了,楼主是否考虑过支持下自动全局打标签?

@yulingtianxia

This comment has been minimized.

Copy link
Owner

yulingtianxia commented Aug 28, 2018

@FMYang 就是全局自动打标签呀,然后用自动化测试脚本去抓。只是是懒加载,只有你去取标签的时候,才会给你生成标签。
我真对成员变量名只是去掉下划线而已,没有依赖下划线识别是否是成员变量,swift的后缀不去掉也无所谓的。

@FMYang

This comment has been minimized.

Copy link
Author

FMYang commented Aug 28, 2018

我的工程是swift4.2写的,集成TBUIAutoTest后,没有以变量名打标签
image
上面这段没走,请问是什么原因

@yulingtianxia

This comment has been minimized.

Copy link
Owner

yulingtianxia commented Aug 28, 2018

@FMYang 能发下复现的 demo 么?目前还没试过 Swift 项目

@FMYang

This comment has been minimized.

Copy link
Author

FMYang commented Aug 29, 2018

yulingtianxia added a commit that referenced this issue Sep 27, 2018

fix bugs
issue: #7
@yulingtianxia

This comment has been minimized.

Copy link
Owner

yulingtianxia commented Sep 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.