提交 c614886a 编写于 作者: DCloud_iOS_XHY's avatar DCloud_iOS_XHY

iOS平台修改native-view 示例

上级 b1abc1fe
...@@ -2,10 +2,10 @@ import { UIButton, UIControl,ButtonType } from "UIKit" ...@@ -2,10 +2,10 @@ import { UIButton, UIControl,ButtonType } from "UIKit"
export class NativeButton { export class NativeButton {
element : UniObjectElement; element : UniNativeViewElement;
button : UIButton; button : UIButton;
constructor(element : UniObjectElement) { constructor(element : UniNativeViewElement) {
this.element = element; this.element = element;
this.button = new UIButton(type=UIButton.ButtonType.system) this.button = new UIButton(type=UIButton.ButtonType.system)
super.init() super.init()
...@@ -34,7 +34,7 @@ export class NativeButton { ...@@ -34,7 +34,7 @@ export class NativeButton {
*/ */
@objc buttonClickAction() { @objc buttonClickAction() {
// 发送事件 // 发送事件
let event = new UniObjectCustomEvent("customClick") let event = new UniNativeViewEvent("customClick")
this.element.dispatchEvent(event) this.element.dispatchEvent(event)
} }
......
...@@ -49,6 +49,7 @@ export class NativeTimePicker { ...@@ -49,6 +49,7 @@ export class NativeTimePicker {
this.updateTime() this.updateTime()
} }
// 更新显示
updateTime() { updateTime() {
let formatter = DateFormatter() let formatter = DateFormatter()
formatter.dateFormat = "HH:mm" formatter.dateFormat = "HH:mm"
...@@ -74,7 +75,7 @@ export class NativeTimePicker { ...@@ -74,7 +75,7 @@ export class NativeTimePicker {
let minuteString = formatter.string(from = this.timePicker.date) let minuteString = formatter.string(from = this.timePicker.date)
const detail = { "hour": hourString, "minute": minuteString } const detail = { "hour": hourString, "minute": minuteString }
const event = new UniObjectCustomEvent("timechanged", detail) const event = new UniNativeViewEvent("timechanged", detail)
this.element.dispatchEvent(event) this.element.dispatchEvent(event)
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册