我有一个按钮,选中后,按钮的标题文本上会出现一个白框。我不希望这个白色的盒子出现。看图像。 button state unselected button state selected
如果我删除if语句并按下按钮以便只能选择但不能取消选择,则在选择时,此白框不会出现。控制它的代码低于......
vm.channelId = {};
vm.creatorAccountCreationFormSubmit = function() {
YoutubeService.getChannelIdFromYoutubeUsername(ConstantsService.youtubeSettings().youtubeApiKey, vm.connectYoutubeFormData.youtubeUsername).then(function(succ) {
vm.channelId = succ;
$log.info(vm.channelId);
}, function error(err) {
$log.error('Error: ', err);
});
};
答案 0 :(得分:0)
答案 1 :(得分:0)
刚刚找到解决方案。添加这行代码 -
button.tintColor = .clear
现在 -
@IBAction func backButtonPressed(_ sender: Any) {
if let button = sender as? UIButton {
if button.isSelected {
createWorkoutButton.isEnabled = false
backButton.backgroundColor = #colorLiteral
backButtonPressed = false
backButton.isSelected = false
button.tintColor = .clear // Add this line of code
} else {
createWorkoutButton.isEnabled = true
backButton.backgroundColor = #colorLiteral
backButtonPressed = true
backButton.isSelected = true
button.tintColor = .clear
}
}
}