提交 3167b90a 编写于 作者: W wangtiantian

IssueNo:https://gitee.com/openharmony/graphic_ui/issues/I3YQ8L

Description:fix uipicker bug
Sig:graphic
Feature or Bugfix:Bugfix
Binary Source:No
Signed-off-by: Nwangtiantian <wangtiantian19@huawei.com>
上级 5ebc3d27
...@@ -103,13 +103,7 @@ UILabel* TextAdapter::GetDynamicText(UIView* inView, int16_t index) ...@@ -103,13 +103,7 @@ UILabel* TextAdapter::GetDynamicText(UIView* inView, int16_t index)
for (int16_t i = 0; i < index; i++) { for (int16_t i = 0; i < index; i++) {
node = node->next_; node = node->next_;
} }
UILabel* newView = nullptr; UILabel* newView = CreateUILabel(inView);
if (inView == nullptr) {
newView = new UILabel();
} else {
newView = static_cast<UILabel*>(inView);
}
if (newView != nullptr) { if (newView != nullptr) {
newView->SetText(node->data_); newView->SetText(node->data_);
if (fontName_ == nullptr) { if (fontName_ == nullptr) {
...@@ -127,13 +121,7 @@ UILabel* TextAdapter::GetIntegerText(UIView* inView, int16_t index) ...@@ -127,13 +121,7 @@ UILabel* TextAdapter::GetIntegerText(UIView* inView, int16_t index)
if ((index < 0) || ((integerTextEnd_ - integerTextStart_) < index)) { if ((index < 0) || ((integerTextEnd_ - integerTextStart_) < index)) {
return nullptr; return nullptr;
} }
UILabel* newView = nullptr; UILabel* newView = CreateUILabel(inView);
if (inView == nullptr) {
newView = new UILabel();
} else {
newView = static_cast<UILabel*>(inView);
}
if (newView != nullptr) { if (newView != nullptr) {
char buf[BUF_LEN] = {0}; char buf[BUF_LEN] = {0};
if (formatter_ != nullptr) { if (formatter_ != nullptr) {
...@@ -166,6 +154,14 @@ UILabel* TextAdapter::GetIntegerText(UIView* inView, int16_t index) ...@@ -166,6 +154,14 @@ UILabel* TextAdapter::GetIntegerText(UIView* inView, int16_t index)
return newView; return newView;
} }
UILabel* TextAdapter::CreateUILabel(UIView* inView)
{
if (inView == nullptr) {
return new UILabel();
}
return static_cast<UILabel*>(inView);
}
void TextAdapter::ClearDynamicText() void TextAdapter::ClearDynamicText()
{ {
ListNode<const char*>* node = dynamicText_.Begin(); ListNode<const char*>* node = dynamicText_.Begin();
......
...@@ -255,6 +255,7 @@ public: ...@@ -255,6 +255,7 @@ public:
} }
protected: protected:
virtual UILabel* GetTextView(UIView* inView, int16_t index); virtual UILabel* GetTextView(UIView* inView, int16_t index);
virtual UILabel* CreateUILabel(UIView* inView);
uint8_t dataMode_; uint8_t dataMode_;
private: private:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册