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 73ccce3f0e7d40e2bcfad6352ab5384e86fc2339..7ee6499fef447ecd42facebac1138ece0575e885 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 19dc4dccc9d99d0e4bc685dd37c1c854e83a3a10..1c4dcb902d471345a6b3a91ffc68c8cf11c1a88f 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) }