bool InitButtonExt(UILabelButtonExt *&button, int left, int top, int width, int height, const char *viewId, UIResourceTextId id, int fontSize)
{
// 创建新按钮(如果当前按钮为空)
- button = new UILabelButtonExt();
if (button == nullptr)
{
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitButtonExt is error");
- return false; // 内存分配失败,返回false
+ button = new UILabelButtonExt();
+ if (button == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitButtonExt is error");
+ return false; // 内存分配失败,返回false
+ }
}
button->SetPosition(left, top);
button->Resize(width, height);