【问题标题】:textField Input String convert into UINT32textField 输入字符串转换为 UINT32
【发布时间】:2013-05-10 12:16:37
【问题描述】:

需要一点帮助。 如何将文本字段中的数字保存到 NSInteger 变量中?

我得到了这个属性:

@property(weak, nonatomic) IBOutlet UITextField *textFieldPort;
@property NSInteger *portTemp;

我想要这样的东西:

_portTemp = _textFieldPort.text;

我需要变量通过

CFStreamCreatePairWithSocketToHost(NULL, (__bridge CFStringRef)address, port, NULL, &writeStream);

有人知道吗?

【问题讨论】:

    标签: ios string uitextfield textfield uint32


    【解决方案1】:

    做那个朋友真的很容易,试试这个

    _portTemp = [_textFieldPort.text integerValue];
    

    【讨论】:

    • 谢谢你。有了这个我可以编译但得到一个警告:“从'int'分配给“NSInteger *”(又名int)的指针转换不兼容
    • 谢谢你。这就是问题所在;-)
    猜你喜欢
    • 1970-01-01
    • 2017-02-01
    • 2019-11-15
    • 2015-10-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-28
    相关资源
    最近更新 更多