小编den*_*cka的帖子

UserNotifications取消,swift3

我正在使用app,用户可以为每日本地通知设置时间,然后我可以选择启用或禁用这些通知.我的问题如何禁用/取消已设置的通知?

在其中一个IF我需要取消通知

override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {

    if (indexPath as NSIndexPath).row == 1 && switchiBtn.isOn == false {

        return 0.0
    }
    if (indexPath as NSIndexPath).row == 2 {
        if switchiBtn.isOn == false || dpVisible == true {
            return 0.0
        }
        return 216.0
    }

    if (indexPath as NSIndexPath).row == 3 {
        if switchiBtn.isOn == false || dpVisible == true {
            return 0.0
        }
        return 44
    }
    return 50.0
}
Run Code Online (Sandbox Code Playgroud)

以下是日程安排和按钮的功能,我在这里设置通知.

func scheduleNotif(date: DateComponents, completion: @escaping …
Run Code Online (Sandbox Code Playgroud)

xcode ios nsusernotification swift

9
推荐指数
2
解决办法
8788
查看次数

RxSwift 访问indexPath.section

伙计们,我对 Rxswift 完全陌生,有没有办法在 RxSwift 中实现这种情况?

我得到的是这个..但问题是我没有indexPath

datasource.sectionModels
        .asObservable()
        .bindTo(tableView.rx.items) { tableView, row, element in
            guard let sectionType = SectionType(rawValue: indexPath.section) else { return 0 }

            let indexPath = IndexPath(row: row, section: 0)

            var itemForIndexPath: SectionViewModel {
                return self.datasource.sectionModels.value[indexPath.section]
            }

            switch sectionType {
            case .nickTitle, .nickIfno:
                let infoCell = tableView.dequeueReusableCell(
                    withIdentifier: InfoTableViewCell.name,
                    for: indexPath
                    ) as! InfoTableViewCell

                var datasource: InfoCellDatasourceProtocol = InfoCellNormalState(text: itemForIndexPath.text)
                if itemForIndexPath.errorStyle {
                    datasource = InfoCellErrorState(text: itemForIndexPath.text)
                }

                infoCell.configureCell(datasource: datasource)
            }
Run Code Online (Sandbox Code Playgroud)

这就是我在 RxSwift 中需要的

func tableView(_ tableView: UITableView, …
Run Code Online (Sandbox Code Playgroud)

uitableview ios swift rx-swift indexpath

5
推荐指数
2
解决办法
3491
查看次数