У меня есть ячейка табличного представления, в которой я использую лист действий для изменения языка приложения. После того, как действие произошло, я хочу изменить название отображаемого языка. Как я могу получить доступ к этой камере? Могу ли я использовать подписки для вызова и редактирования названия кнопки для этой ячейки ??
let actionSheet = UIAlertController(title:NSLocalizedString("Message", comment: "Message"), message:"", preferredStyle:.actionSheet)
//
actionSheet.addAction(UIAlertAction(title:"English", style:.default, handler: { (action) in
Bundle.setLanguage("en")
self.navigationController?.dismiss(animated:true, completion:nil)
self.languageSelected.text = "English"
self.cell.notificationButton.setTitle("English" , for: .normal )
self.lang = 0
self.langChange()
////////////////////////////////////////////////
func langChange() {
if lang == 0 {
cell.notificationButton.setTitle("English" , for: .normal )}
if lang == 1 {
cell.notificationButton.setTitle("Hindi" , for: .normal )}
if lang == 2 {
cell.notificationButton.setTitle("Tamil" , for: .normal )}
if lang == 3 {
cell.notificationButton.setTitle("Telugu" , for: .normal )}
}
////////////////////////////////////////
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
cell = tableView.dequeueReusableCell(withIdentifier: "reuseIdentifier", for: indexPath) as! AppSettingViewCell
cell.selectionStyle = .none
cell.leftText.text = menuArray[indexPath.row]
cell.isUserInteractionEnabled = true
if lang == 0 {
cell.notificationButton.setTitle("English" , for: .normal )}
if lang == 1 {
cell.notificationButton.setTitle("Hindi" , for: .normal )}
if lang == 2 {
cell.notificationButton.setTitle("Tamil" , for: .normal )}
if lang == 3 {
cell.notificationButton.setTitle("Telugu" , for: .normal )}
if indexPath.row == 0 {
cell.notificationButton = UIButton()
cell.languageLabel = UILabel()
cell.addSubview(cell.notificationButton)
cell.addSubview(cell.languageLabel)
languageSelected.textColor = appGreenTheme
cell.languageLabel.text = languageSelected.text
cell.languageLabel.textColor = appGreenTheme
cell.languageLabel.isHidden = true
cell.notificationButton.setTitleColor(appGreenTheme, for: .normal)
cell.notificationButton.isHidden = false
..
Я пытался изменить его многими методами, но заголовок в первой ячейке не меняется. Пожалуйста, кто-нибудь может помочь?