首页 > TAG信息列表 > NotificationCenter

Swift 视图随键盘弹出向上移动

主要是通过观察者监听来完成 import UIKit class TFVC: UIViewController { override func viewDidLoad() { super.viewDidLoad() hideKeyboardWhenTappedAround() let tf = UITextField(frame: CGRect(x: 0, y: 0, width: 120, height: 44))

Combine 框架,从0到1 —— 4.在 Combine 中使用通知

  本文首发于 Ficow Shen's Blog,原文地址: Combine 框架,从0到1 —— 4.在 Combine 中使用通知。   内容概览 前言 让通知处理代码使用 Combine 总结   前言   通知中心是苹果开发者常用的功能,很多框架都会使用通知中心来向外部发送异步事件。对于iOS开发人员而言,以下代码一

Swift - NotificationCenter通知的基本使用

不管是通知,还是代理,闭包,说白了,其主要目的都是在不同的类之间传值,比如你想在classA中得到classB中的东西,classC中得到classD中的东西。 下面是一个浅显的例子: // 点击按钮present到控制器ItemViewController中 @IBAction func next(_ sender: Any) { let nextVC = I

CocosCreator全局消息事件

我的git有代码,如下: NotificationCenter.ts import { NotificationName } from "./NotificationName"; /** * CocosCreator's global Event/Message Center. */ export class NotificationCenter { private eventTarget: cc.EventTarget = new cc.EventTarget