将Scanf与ObjC和iPhone结合使用 [英] Using Scanf with ObjC and iPhone

查看:43
本文介绍了将Scanf与ObjC和iPhone结合使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试制作iPhone应用程序,并阅读我之前推荐的教程和书籍:)我试图查找有关scanf/将用户输入数据从文本字段存储到变量中的信息,以便以后使用在我的程序中.文本字段实际上是一个数字字段,因此我尝试保存输入的整数而不是文本,因为在我的情况下将不会有任何整数.我在这里走错了路吗?任何帮助将不胜感激.

trying to make an iPhone app and going through the tutorials and books recommended by those before me :) I'm trying to find information on the scanf/storing user input data from a text field into a variable which I can use later in my program. The text field is actually a number field, so I am trying to save the integers they input and not the text since there won't be any in my case. Am I on the wrong path here? Any help would be greatly appreciated.

推荐答案

如果我本质上在尝试将数字输入保存到始于

what about if i am essentially trying to save the input that is a number to begin with

您要 NSNumberFormatter .数据格式化程序(

You want NSNumberFormatter. The data formatters ( Apple Guide) handle conversions to and from strings as well as formatting for output.

这篇关于将Scanf与ObjC和iPhone结合使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆