Exemplo n.º 1
0
TextField* TextField::create()
{
    TextField* widget = new TextField();
    if (widget && widget->init())
    {
        widget->autorelease();
        return widget;
    }
    CC_SAFE_DELETE(widget);
    return NULL;
}
Exemplo n.º 2
0
TextField* TextField::create()
{
    TextField* widget = new (std::nothrow) TextField();
    if (widget && widget->init())
    {
        widget->autorelease();
        return widget;
    }
    CC_SAFE_DELETE(widget);
    return nullptr;
}
Exemplo n.º 3
0
TextField* TextField::create()
{
    TextField* widget = new TextField();
    if (widget && widget->init())
    {
        CC_SAFE_AUTORELEASE(widget);
        return widget;
    }
    CC_SAFE_DELETE(widget);
    return NULL;
}
Exemplo n.º 4
0
TextField* TextField::create(const std::string &placeholder, const std::string &fontName, int fontSize)
{
    TextField* widget = new (std::nothrow) TextField();
    if (widget && widget->init())
    {
        widget->setFontName(fontName);
        widget->setFontSize(fontSize);
        widget->setPlaceHolder(placeholder);
        widget->autorelease();
        return widget;
    }
    CC_SAFE_DELETE(widget);
    return nullptr;
}