cocos lua ccui.TextField 本文输入框 editbox手机无法正常输入

	local motify_bg = self.lbl_modity_bg:GetView()
	local x, y = motify_bg:getPosition()
	local size = motify_bg:getContentSize()
	local ap = motify_bg:getAnchorPoint()
	size = cc.size(size.width-20, size.height-20)
	self.text_field = ccui.TextField:create("点击开始修改工会公告", "res/font/cght.TTF", 20)
	self.text_field:setPosition(cc.p(x, y))
	self.text_field:setAnchorPoint(ap)
	self.text_field:setTouchSize(size)
	self.text_field:setMaxLength(100)
	self.text_field:setMaxLengthEnabled( true)
	self.text_field:ignoreContentAdaptWithSize(false)    --设置自动换行 1
	self.text_field:setContentSize(size)                 --设置自动换行 2
	-- self.text_field:attachWithIME()
	self.lot_root:GetView():addChild(self.text_field)

self.btn_yes:SetData({onclick=function()
		Game("GuildView"):ClosePanel("ModifyNoticeView")
		local info = self.text_field:getString()    --获取文本框内容
		if info ~= nil and #info > 0 then
			if self:isIllegal(info) then
				self.text_field:setString("")     --设置文本框内容
				return 
			end
			self.text_field:setString("") 
			Tool("Notifier"):Fire("MODIFY_NOTICE", nil, info)
		end
	end})

 

你可能感兴趣的:(lua,cocos2d-x)