我有一个文本表单字段可输入密码,我在该行中添加了可见性图标按钮。如何将下划线扩展到图标下方? (在文本表单字段中有一个验证器,因此我希望扩展相同的行以使行为相同)。
答案 0 :(得分:1)
在import AVFoundation
class MusicHelper {
static let sharedHelper = MusicHelper()
var audioPlayer: AVAudioPlayer?
func playBackgroundMusic() {
let aSound = NSURL(fileURLWithPath: Bundle.main.path(forResource: "MUSICNAME", ofType: "mp3")!)
do {
audioPlayer = try AVAudioPlayer(contentsOf:aSound as URL)
audioPlayer!.numberOfLoops = -1
audioPlayer!.prepareToPlay()
audioPlayer!.play()
}
catch {
print("Cannot play the file")
}
}
中将import AVFoundation **//import at the top**
var player: AVAudioPlayer? **//declare in code**
MusicHelper.sharedHelper.playBackgroundMusic() **//paste in viewDidLoAd**
定义为IconButton
:
prefixIcon