Exemple #1
0
void UITextField::InitFromXIB(XIBObject* obj) {
    UIControl::InitFromXIB(obj);

    _shadowOffset = obj->GetSize("IBUIShadowOffset", 0.0, 0.0f);
    _text = obj->GetString("IBUIText", NULL);
    _textColor = obj->FindMember("IBUITextColor");
    _placeholder = obj->GetString("IBUIPlaceholder", NULL);
    _borderStyle = obj->GetInt("IBUIBorderStyle", 0);
    _font = (UIFont*)obj->FindMember("IBUIFontDescription");
    if (!_font) {
        _font = (UIFont*)obj->FindMember("IBUIFont");
    }

    XIBObject* inputTraits = obj->FindMember("IBUITextInputTraits");
    if (inputTraits) {
        _autoCorrectionType = inputTraits->GetInt("IBUIAutocorrectionType", 0);
        _returnKeyType = inputTraits->GetInt("IBUIReturnKeyType", 0);
    }

    _clearsOnBeginEditing = obj->GetBool("IBUIClearsOnBeginEditing", false);
    if (_clearsOnBeginEditing) {
        _clearButtonOffset.width = 3.0f;
        _clearButtonOffset.height = 1.0f;
    }
    obj->_outputClassName = "UITextField";
}
Exemple #2
0
void UITextView::InitFromXIB(XIBObject *obj)
{
    UIScrollView::InitFromXIB(obj);

    _shadowOffset = obj->GetSize("IBUIShadowOffset", 0, 0.0f);
    _text = obj->GetString("IBUIText", NULL);
    _textColor = obj->FindMember("IBUITextColor");
    _font = (UIFont *) obj->FindMember("IBUIFontDescription");
    _editable = obj->GetBool("IBUIEditable", true);
    _dataDetectorTypes = obj->GetInt("IBUIDataDetectorTypes", 0);   
    if ( !_font ) _font = (UIFont *) obj->FindMember("IBUIFont");
    _textAlignment = 0;

    XIBObject *inputTraits = obj->FindMember("IBUITextInputTraits");
    if ( inputTraits ) {
        _autoCorrectionType = inputTraits->GetInt("IBUIAutocorrectionType", 0);
        _returnKeyType = inputTraits->GetInt("IBUIReturnKeyType", 0);
    }
    obj->_outputClassName = "UITextView";
}