问题标签 [viewwithtag]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
532 浏览

swift - 使用 Swift 枚举作为没有 rawValue 的视图标签号

我有一个整数枚举,我想将它用于viewWithTag(_:)数字,但它给了我错误“无法将类型'viewTags'的值转换为预期的参数类型'Int'”,即使枚举和标签号都需要inviewWithTag(_:)是一个Int.

这很简单,如果我使用该属性,我可以让它工作rawValue,但这比我想要的更混乱和麻烦。