[go: nahoru, domu]

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

使用Xcode的Debug View Hierarchy查看视图层级时有Optimization Opportunities警告 #210

Open
viihua opened this issue Jun 2, 2022 · 1 comment

Comments

@viihua
Copy link
viihua commented Jun 2, 2022

image
image
初步判断是JXSegmentedTitleCell中的maskTitleLabel导致的,没有使用到遮罩Title.
image

@viihua
Copy link
Author
viihua commented Jun 2, 2022

@pujiaxin33 大牛看看有没有什么问题。
自己研究了下,认为不破坏原有代码结构的话 就在第141行的maskTitleLabel.isHidden = true 后面加 maskTitleLabel.layer.mask = nil,如果是使用pod的话就用我以下的文本放入Podfile,前面那个有点小问题,一个空格都不能少哦,字符串查找替换的:

post_install do |installer|
find_and_replace("Pods/JXSegmentedView/Sources/Title/JXSegmentedTitleCell.swift",
" maskTitleLabel.isHidden = true\n titleLabel.layer.mask = nil"," maskTitleLabel.isHidden = true\n maskTitleLabel.layer.mask = nil\n titleLabel.layer.mask = nil")
end
#注入代码到指定文件
def find_and_replace(dir, findstr, replacestr)
Dir[dir].each do |name|
FileUtils.chmod("+w", name) #add
text = File.read(name)
replace = text.gsub(findstr,replacestr)
if text != replace
puts "Fix: " + name
File.open(name, "w") { |file| file.puts replace }
STDOUT.flush
end
end
Dir[dir + '*/'].each(&method(:find_and_replace))
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant