Не удалось загрузить NIB в связке (загружен) с именем - PullRequest
0 голосов
/ 08 февраля 2020

Я попытался реализовать встроенный DatePicker и получил ошибку: «Не удалось загрузить NIB в связке (загружен)« с именем ». Я попытался проверить копии Bundle Resources, очистить папку сборки и проверить членство в Terget. Ничто не сработало для этой проблемы. Я хотел бы спросить вас о любых решениях. Спасибо.

это ссылка, которую я хочу. https://medium.com/@tharanit99 / как внедрить средство выбора даты в ios -with-swift-4-9f8274460db c

protocol DatePickerDelegate: class {
    func didChangeDate(date: Date, indexPath: IndexPath)
}

class DayPickerTableViewCell: UITableViewCell {


    @IBOutlet weak var dayPicker: UIDatePicker!
    var indexPath: IndexPath!
    weak var delegate: DatePickerDelegate?

    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

    class func reuseIdentier() -> String {
        return "dayPicker"
    }

    func updateCell(date: Date, indexPath: IndexPath) {
        dayPicker.setDate(date, animated: true)
        self.indexPath = indexPath
    }
}

import UIKit

// Date Format type
enum DateFormatType: String {
    /// Time
    case time = "HH:mm:ss"

    /// Date with hours
    case dateWithTime = "dd-MMM-yyyy  H:mm"

    /// Date
    case date = "dd-MMM-yyyy"
}

class DateCallingTableViewCell: UITableViewCell {

    @IBOutlet weak var DateCallingLabel: UILabel!

    func updateText(date: Date) {
        DateCallingLabel.text = date.convertToString(dateformat: .dateWithTime)
    }

    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

}


extension Date {

    func convertToString(dateformat formatType: DateFormatType) -> String {
        let dateFormatter = DateFormatter()
        dateFormatter.dateFormat = formatType.rawValue
        let newDate: String = dateFormatter.string(from: self)
        return newDate
    }

}

XIB файл изображения

...