From c614886abf25bee1312dd4389cadf6e0846cffc4 Mon Sep 17 00:00:00 2001 From: XHY Date: Mon, 12 Aug 2024 20:01:32 +0800 Subject: [PATCH] =?UTF-8?q?iOS=E5=B9=B3=E5=8F=B0=E4=BF=AE=E6=94=B9native-v?= =?UTF-8?q?iew=20=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uni_modules/uni-native-button/utssdk/app-ios/index.uts | 10 +++++----- uni_modules/uni-time-picker/utssdk/app-ios/index.uts | 5 +++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/uni_modules/uni-native-button/utssdk/app-ios/index.uts b/uni_modules/uni-native-button/utssdk/app-ios/index.uts index 73ccce3f..7ee6499f 100644 --- a/uni_modules/uni-native-button/utssdk/app-ios/index.uts +++ b/uni_modules/uni-native-button/utssdk/app-ios/index.uts @@ -2,19 +2,19 @@ import { UIButton, UIControl,ButtonType } from "UIKit" export class NativeButton { - element : UniObjectElement; + element : UniNativeViewElement; button : UIButton; - constructor(element : UniObjectElement) { + constructor(element : UniNativeViewElement) { this.element = element; this.button = new UIButton(type=UIButton.ButtonType.system) super.init() - + // 在 swift target-action 对应的方法需要以OC的方式来调用,那么OC语言中用Selector来表示一个方法的名称(又称方法选择器),创建一个Selector可以使用 Selector("functionName") 的方式。 const method = Selector("buttonClickAction") // button 添加点击回调 button.addTarget(this, action = method, for = UIControl.Event.touchUpInside) - + this.bind(); } @@ -34,7 +34,7 @@ export class NativeButton { */ @objc buttonClickAction() { // 发送事件 - let event = new UniObjectCustomEvent("customClick") + let event = new UniNativeViewEvent("customClick") this.element.dispatchEvent(event) } diff --git a/uni_modules/uni-time-picker/utssdk/app-ios/index.uts b/uni_modules/uni-time-picker/utssdk/app-ios/index.uts index 19dc4dcc..1c4dcb90 100644 --- a/uni_modules/uni-time-picker/utssdk/app-ios/index.uts +++ b/uni_modules/uni-time-picker/utssdk/app-ios/index.uts @@ -48,7 +48,8 @@ export class NativeTimePicker { this.m = minute this.updateTime() } - + + // 更新显示 updateTime() { let formatter = DateFormatter() formatter.dateFormat = "HH:mm" @@ -74,7 +75,7 @@ export class NativeTimePicker { let minuteString = formatter.string(from = this.timePicker.date) const detail = { "hour": hourString, "minute": minuteString } - const event = new UniObjectCustomEvent("timechanged", detail) + const event = new UniNativeViewEvent("timechanged", detail) this.element.dispatchEvent(event) } -- GitLab