Используя параметры настройки приложения через блоки

Это может быть вероятным решением вашей проблемы:

Пример кодирования:

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

    if tableView == self.tableViewNotifica {
        let cell = tableView.dequeueReusableCell(withIdentifier: "cellNotifica", for: indexPath) as? TableViewCellComunicazioni
        let dataNotifica = structNotifica[indexPath.row].dateNotifica
        let testoNotifica = structNotifica[indexPath.row].textNotifica

        cell?.dateNotification.text = "\(date!)"
        cell?.textNotification.text = "\(text!)"
        return cell!
    }
    if tableView == self.tableViewInbox {
        let  cell = tableView.dequeueReusableCell(withIdentifier: "cellInbox", for: indexPath) as? TableViewCellComunicazioni
        let email = structInbox[indexPath.row].email
        let messaggio = structInbox[indexPath.row].messaggio
        let data = structInbox[indexPath.row].data

        cell?.emailInbox.text = "\(email!)"
        cell?.messaggioInbox.text = "\(message!)"
        cell?.dataInbox.text = "\(date!)"
        return cell!
    }
      return UITableViewCell()
    }

И убедитесь, что у вас есть правильный идентификатор ячейки для удаления из очереди.

extension ViewController : UITableViewDelegate,UITableViewDataSource {
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return listmoviesArray.count
    }

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        if tableView == moviesTableView {
            let cell = tableView.dequeueReusableCell(withIdentifier: "MovieTableViewCell", for: indexPath) as! MovieTableViewCell
            cell.delegate = self
            cell.setupCell(listmoviesArray[indexPath.row],indexPath: indexPath)
            return cell
        } else {
            let cell = tableView.dequeueReusableCell(withIdentifier: "MovieTableViewCell2", for: indexPath) as! MovieTableViewCell
            cell.delegate = self
            cell.setupCell(listmoviesArray[indexPath.row],indexPath: indexPath)
            return cell
        }

    }

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    if tableView == moviesTableView {
    // Handle your selection for row. 
    } else {
       //Handle your selection for row.
    }
  }
}

Выше код производит следующий вывод с 2 Tableview.

enter image description here

5
задан Brian Ortiz 16 November 2008 в 00:33
поделиться

3 ответа

Позвольте главному приложению получить сменный каталог от параметров настройки приложения и продвинуть его в сменную систему.

3
ответ дан 14 December 2019 в 13:50
поделиться

Возможно, Вы могли вставить конфигурацию как аргумент при создании плагина?

//Get the configuration for the current appDomain
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

//Create the plugin, and pass in the configuration
IPlugin myPlugin = new AlfaPlugin(config);

Вам, вероятно, будет нужна ссылка на Систему. Блок конфигурации.

2
ответ дан 14 December 2019 в 13:50
поделиться

Можно записать раздел пользовательской конфигурации, который позволяет Вам писать объекты, представляющие XML-схему. После того, как установленный, можно просто попросить текущий экземпляр того раздела.

Можно сделать это путем получения из System.Configuration.ConfigurationSection и запись свойств, которые представляют атрибуты и подэлементы. Для получения дополнительной информации посмотрите Как к: Создайте Разделы Пользовательской конфигурации Используя ConfigurationSection.

AppDomain, в котором работает библиотека, является текущим объемом конфигурации. System.Configuration пространство имен коррелирует все файлы конфигурации и представляет объединенное представление.

Для получения текущего экземпляра раздела можно использовать ConfigurationManager.GetSection(...).

Ваш плагин должен принять экземпляр этого раздела вместо генерала Configuration объект.

1
ответ дан 14 December 2019 в 13:50
поделиться
Другие вопросы по тегам:

Похожие вопросы: