Using UITextField for number input

Hi there,
I´m fairly new to the Objective-C scene. Right now I´m trying to put an application for the iPhone together. There should be some user input in a way that the user inputs some numbers and the program uses the different numbers to calculate an output.
As far as I have seen into the iPhone SDK there seems to be only the UITextField for the input, but you only get NSString back.
Is there a different method for number input, something like UINumberField? Or how can I convert the string into something like float or integer?
I would greatly appreciate if you could make some code examples, you know since +I´m new to the Objective-C scene+.
Thank you for your help.
Dietmar, Ulm, Germany

Thank you that worked, somehow. I now have a rather complicated changing from string to double, doing the calculation, to number and back to string for the output:
+NSString *newWeight = textFieldWeight.text;+
+NSString *newSize = textFieldSize.text;+
+double newWeightDouble = newWeight.doubleValue;+
+double newSizeDouble = newSize.doubleValue;+
+double calc = newWeightDouble /= newSizeDouble;+
+NSNumber *calcNum = [[NSNumber alloc] initWithDouble:calc];+
+NSString *calcText = calcNum.stringValue;+
It does work, but I would prefer, let´s say: a rather smoother way.

Similar Messages

  • Using substring for entire input  string

    Hi,
    I am getting values required from a FM as big string so I have to parse that string into chunks and then get flat file.
    SOURCE:
    ZXYZ_abc
    ---data
          ---abc(This abc has entire data as a big string)
    example value   sdn12345xyx789
    Target
    I have created DT type of the similar structure as source
    TG_ABC
    ---data
       ---xyz
           fd1
           fd2
           fd3
           fd4
    now I wan tto parse above string and get those parsed values into target fields fd1 ,fd2 fd3 like
    output flat file with '||' delimited
    sdn || 12345 || xyx || 789
    I am trying to do in the mapping
    abc-substring(0-3)--fd1
    abc--substring(38)--fd2
    etc...
    but I am not getting any value
    it just created empty file in the target.
    please help.
    thank you.
    Babu

    Raj,
    parsing the string,it doesnt parse the input large string to different output fields.
    I dont see any values in payload in SXMB_MONI ,it just created empty tag with Messsagetype name.infact it supposed to have values within tags with parsed values.
    i am using single source field and apply substring function on it and map to target fields as I explained in the example I gave.
    when I test the map with map testing option ,it doesnt give any value on target side,so should be prob with parsing only.

  • Am I suppose to use pulseaudio for my microphone?

    In audacity, if I select my mic with alsa it works fine. But selecting pulse I get no mic sound. So my mic doesn't work in skype, wine, etc...
    Is there suppose to be some way of getting the mic working with pulse, or should programs be selected to use alsa for the input?

    Short - no, you are suppose to use whatever you want. Little longer - is it usb of some sort, did you read wiki for skype and pulse? Also last time i check wine does not support pusleaudio.

  • Using a For Loop Index for Array Element Number?

    Hi.  Thanks in advance for the help.  I can't seem to find what I want to do here using the search function... probably because I don't know how to frame the question appropriately.  Ignore the title to this post cause it's probably wrong vocabulary for what I want to do.
    Here's the situation:
    I have a 2D array where the first column is the X data and each subsequent column is Y data (call it Y1...Yn).  The n-value varies from run to run (some runs have 4 columns of data, some have 20), but that is easily gathered when reading the data file.  I need to perform a number of operations on each set of data, the least of which is smoothing the data and graphing it, so I'm limiting my discussion to these 2 operations.
    What I want is a for loop structure where the indexing of the loop tracks the Y1...Yn columns, grabs each column for the iteration, performs the relevant analysis, and spits out the result, but in a stackable manner.  Thus the title; I want to use the for loop's index to mark the array element for building a new array.
    See the image attached.  A 2D array of 9 columns (X, Y1...Y8) is analyzed such that each data set, (X, Y1), (X, Y2)...(X, Y8) is bundled, graphed, run through a B-spline Fit, of which is also graphed.  I need to replace this with something that looks like the for loop structure shown.  
    I just don't know how to get those two data bundles [(X, Yi) and it's smoothed pair] out of the for loop in a stacked set from every iteration of the for loop.
    Again the title, I think I want to build a new array where i use the index of the for loop to control the entries of the new array.  But I can't see how to do that.
    Any help would be appreciated.
    Attachments:
    NeedForLoopForThis.PNG ‏30 KB

    Hello H.R. Dunham, and welcome to the forum!
    It seems that you may be looking for Auto-Indexing, a basic feature of loops in LabVIEW.  You'll need to transpose your array before wiring it into the for loop, as elements are auto-indexed by row before column, but at that point you should be able to operate on each column and output an array of n cluster elements corresponding to your input columns.  Auto-indexing tunnels look like brackets to indicate each element will be indexed automatically- this should be the default when wiring an array into a for loop or when wiring anything out of a for loop.
    As for how to build your pairs, I suggest removing the X column and creating a "starter" cluster containing your X data and placeholder Y data before entering your "Y" processing loop.  Use the bundle by name function in the for loop to insert your processed column data into the cluster and auto-index the cluster output. Flow would be something like this:
    1) Gather data
    2) Split X and Y using standard array operations
    3) Create "template" cluster with shared X data
    4) Pass template cluster and Y-column array into an auto-indexed for loop.
    5) Insert processed Y data into cluster inside loop.
    6) Auto-index cluster data out of loop.
    This tutorial is probably also a good place to get started:
    Getting Started with NI LabVIEW Module 3: Loops
    http://www.ni.com/white-paper/7528/en/
    Hope that helps!
    Regards,
    Tom L.

  • Using differing numbers of inputs for a similar query using DBMS_SQL

    Hi,
    I'm trying to use DBMS_SQL for a query that's either going to include the following WHERE statement:
    "AND sched_requirement_id = pin_sr_id"
    or not base upon conditions passed to the procedure calling it
    v_sql_stmt :=
    'SELECT COUNT(1)
    INTO v_exists
    FROM SCHED_PSA_REQS
    WHERE sched_week_id = pin_sched_week_id
    AND sequence_number = pin_seq_no
    AND sched_original_req_id = pin_sor_id
    ----> AND sched_requirement_id = pin_sr_id<---------
    AND ROWNUM = 1';
    The only reason I can't use NDS for this is because of the pin_sr_id input doesn't exist inside the universe of the v_sql_stmt. If it was an inner join or something I could get away with it.
    I read that DBMS_SQL doesn't care how many input values it gets until the dbms_sql.EXECUTE statement, but in all the documentation I've read through I have yet to come across an example that deals with a varying number of input values. Does anyone out there have an example of DBMS_SQL that deals with a varying number of bind input values based upon a conditional statement or input values?
    Thanks!

    Mike,
    Thanks for your input but the EXECUTE IMMEDIATE I would be using contains the following input values:
    EXECUTE IMMEDIATE v_sql_stmt
    INTO v_psa_req_id USING pin_sched_week_id, pin_seq_no, pin_sor_id, pin_sr_id;
    I experimented with exactly what you suggested with scott/tiger:
    set serveroutput on
    DECLARE
    v_target_val NUMBER;
    v_str varchar2(4000);
    f_tbl varchar2(200);
    f_exp varchar2(200);
    dept_var NUMBER:= 20;
    BEGIN
    f_tbl := ', dept d';
    f_exp := 'and e.deptno = dept_var ';
    --f_exp := ' and e.deptno = d.deptno ';
    v_str := ' Select '
    ||' sal '
    ||' from emp e '
    ||f_tbl
    ||'
    where '
    ||' e.empno = :b_v_for_where_cond '
    ||f_exp;
    dbms_output.put_line(v_str);
    EXECUTE IMMEDIATE v_str
    INTO v_target_val USING 7369;
    dbms_output.put_line(v_target_val);
    EXCEPTION
    when no_data_found then
    dbms_output.put_line('No data exception raised');
    when others then
    dbms_output.put_line(SQLCODE||' '||SQLERRM);
    END;
    The code bombs miserably when I try to introduce a variable that's not fed in from the USING clause. From what I've learned of NDS all values must either be deliberately fed in like from the USING statement or must exist "inside the universe" of that SQL statement. Example if I use the line:
    f_exp := ' and e.deptno = d.deptno ';
    instead it works because d.deptno can be referenced from within that SQL statement from table dept.
    So in my case either pin_sr_id is part of the USING clause or it's not. This is the one thing that DBMS_SQL still has over NDS is the fact "It does not need to know the number and types of arguments it will receive and process." (1) Oracle Database 10g PL/SQL Programming pg. 609.
    They say you can use DESCRIBE_COLUMNS and DESCRIBE_COLUMNS2. However, I've yet to find an example of its use. If anybody has any web links to such it would be greatly appreciated.

  • Hi All, I have been using the adobe CS 5.1. What do you recommend upgrade my CS? or get the subscription on a yearly basis, thanks in advance for your input here,

    hi All, I have been using the adobe CS 5.1. What do you recommend upgrade my CS? or get the subscription on a yearly basis, thanks in advance for your input here

    The decision is ultimately yours.  You have to consider your preferences and reasons for use.
    If you are using the software primarily for personal projects, then have a suite might be all you need, and the one you have now might suffice for that as well.  If you are a professional who needs to be on the cutting edge, then you probably want to have the subscription working for you.
    Upgrading to a new CS means getting CS6, which is likely to be that last of the CS releases.  If you do that you pay for it one time and what you get when you pay is what you will have until it becomes obsolete somewhere off in the future, except for any corrective updates that might be provided.  It should hold up to be useful for some number of years.
    If you purchase a Cloud plan, you pay for it repeatedly over time - basically a monthly fee -  but you get updates and new features as they are released.  There is always a chance that newer updates could eventually out-spec the machine you own, requiring a hardware update to continue on with new releases.

  • I want to buy a hard case for my macbook pro, but I don't know what year it is. When I use the serial number to try and find out, all it says is, "~VIN,MacBook Pro (15-inch Glossy)". When I type that into amazon for a case it gives me nothing!

    I want to buy a hard case for my macbook pro, but I don't know what year it is. When I use the serial number to try and find out, all it says is, "~VIN,MacBook Pro (15-inch Glossy)". When I type that into amazon for a case it gives me nothing!

    Hi T,
    Either of these will give you the info you seek:
    http://www.appleserialnumberinfo.com/Desktop/index.php
    http://www.chipmunk.nl/klantenservice/applemodel.html

  • I have a windows vision for Adobe Creative Suite 4 Design Standard, Can I use same serial number as

    I have a windows vision for Adobe Creative Suite 4 Design Standard, Can I use same serial number with Mac?

    Unfortunately, no. Creative Suite serial numbers are platform specific: Windows only or Mac only.

  • How to restrict number of characters for an input field

    Hi All,
    I have an input field.
    The max number of characters for this input field is 10.
    when a user enter more then 10 characters. it should prompt for an error or the input field should not allow to accpet the 11 character.
    how we do this in VC.
    need your helpful answers
    Rgds
    Srinivas

    Hi Srinu
    You could achieve this by configuring error messages under the formula:-
    Select the control properties and in the Input field at the Display tab write the formula
    "IF((@<LEN(text)>10),'appropriate message','Records available')"
    Note :- there is a LEN(text) under text functions in formula tab.
    Regards
    Navneet
    Message was edited by:
            Navneet Giria

  • Can a ComboBox be used for Text Input ?

    Hi
    In Ms Access the combo box can be used for text input for creating new lines in the Database instead of just being limited to the lines already there in the drop down list. Is this possible with the combo box available in Flex 4. If it is I haven't being successful in getting it to work.
    Thanks for you help in advance
    ParaicKW

    I am using a Dataservices Commit method to write to the Database via a button on the screen
    When I type into the ComboBox's text input and click outside the combobox or on the commit button the application effectively freezes
    SituationService is a CRUD type servicePHP to MYSQL and it works with the Datagrid
    Here is the code -
    ParaicKW
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:situationservice="services.situationservice.*">
        <fx:Script>
            <![CDATA[
                import mx.controls.Alert;
                import mx.events.FlexEvent;
                protected function Situation_creationCompleteHandler(event:FlexEvent):void
                    getAllTblsituationResult3.token = situationService.getAllTblsituation();
                protected function dataGrid_creationCompleteHandler(event:FlexEvent):void
                    getAllTblsituationResult.token = situationService.getAllTblsituation();
                protected function button1_clickHandler(event:MouseEvent):void
                    situationService.commit();
                protected function vGroup_creationCompleteHandler(event:FlexEvent):void
                    getAllTblsituationResult2.token = situationService.getAllTblsituation();
            ]]>
        </fx:Script>
        <fx:Declarations>
            <s:CallResponder id="updateSituationResult"/>
            <situationservice:SituationService id="situationService" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
            <s:CallResponder id="getAllSituationResult"/>
            <s:CallResponder id="getAllTblsituationResult"/>
            <s:CallResponder id="getAllTblsituationResult2"/>
            <s:CallResponder id="getAllTblsituationResult3"/>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <mx:DataGrid x="96" y="167" id="dataGrid" creationComplete="dataGrid_creationCompleteHandler(event)" dataProvider="{getAllTblsituationResult.lastResult}" editable="true" width="470" height="237">
            <mx:columns>
                <mx:DataGridColumn headerText="ID2" dataField="ID2"/>
                <mx:DataGridColumn headerText="SITUATION" dataField="SITUATION" width="200"/>
            </mx:columns>
        </mx:DataGrid>
        <s:Button label="Commit Updates" click="button1_clickHandler(event)"/>
        <s:HGroup width="90%" height="80%" verticalCenter="20" horizontalCenter="0">
            <mx:ComboBox width="476" id="cmbSituation" creationComplete="Situation_creationCompleteHandler(event)" dataProvider="  
                     {getAllTblsituationResult3.lastResult}" labelField="SITUATION" editable="true">
            </mx:ComboBox>
            <s:TextArea width="426" id="textArea" text="{getAllTblsituationResult3.lastResult.SITUATION}"/>
            <s:Button label="Back" click="cmbSituation.selectedIndex = cmbSituation.selectedIndex-1 ; textArea.selectedIndex = textArea.selectedIndex-1"/>
            <s:Button label="Forward" click="cmbSituation.selectedIndex = cmbSituation.selectedIndex+1 ; textArea.selectedIndex = textArea.selectedIndex-1"/>
        </s:HGroup>
    </s:Application>

  • I have an iPhone 5 and updated it to iOS7 but now I can't use iMessage or FaceTime as it says "waiting for activation" and won't let me use my phone number to do iMessage or FaceTime either

    I have an iPhone 5 and updated it to iOS7 last night but now I can't use iMessage or FaceTime as it says "waiting for activation" As well as that, it won't let me use my phone number to do iMessage or FaceTime it will only let me use my apple ID which I don't want to do.

    Thank you for replying.    Yes I deleted the old email address..   

  • Hi ! i have this new itunes account but when i wanna use this for apps he ask me for a card number but i don't have one .what i supposed to do ?

    Hi ! i have this new itunes account but when i wanna use this for apps he ask me for a card number but i don't have one .what i supposed to do ?

    Hi Mada7ina,
    If you are looking to set up an iTunes Store account without an associated credit card, you may find the following article helpful:
    Apple Support: Creating an iTunes Store, App Store, iBooks Store, and Mac App Store account without a credit card
    http://support.apple.com/kb/ht2534
    Regards,
    - Brenden

  • How can i use my phone number for imessage on my macbook pro?

    I have been trying to sync my iMessages between my iPhone 4s and my macbook pro but it will only use my email. I have been told to change the setting in the message menu but I can't seem to find that! Help me please!!!
    Thank you!

    TRy to check on your imessage setting on your iphone. It should be setting>messages> imessage. If you can see your phone number then your mac will be able to see your message. If not toggle the message on and off. Once activated your mac will ask you if you would like to use your number for imessage, click agree(0r yes) then you will also receive a message on your iphone that your mac started using your phone number for imessage

  • Unable to get the SharePoint 2013 List names using Client object model for the input URL

    Please can you help with this issue.
    We are not able to get the SharePoint 2013 List names using Client object model for the input URL.
    What we need is to use default credentials to authenticate user to get only those list which he has access to.
    clientContext.Credentials = Net.CredentialCache.DefaultCredentials
    But in this case we are getting error saying ‘The remote server returned an error: (401) Unauthorized.’
    Instead of passing Default Credentials, if we pass the User credentials using:
    clientContext.Credentials = New Net.NetworkCredential("Administrator", "password", "contoso")
    It authenticates the user and works fine. Since we are developing a web part, it would not be possible to pass the user credentials. Also, the sample source code works perfectly fine on the SharePoint 2010 environment. We need to get the same functionality
    working for SharePoint 2013.
    We are also facing the same issue while authenticating PSI(Project Server Interface) Web services for Project Server 2013.
    Can you please let us know how we can overcome the above issue? Please let us know if you need any further information from our end on the same.
    Sample code is here: http://www.projectsolution.com/Data/Support/MS/SharePointTestApplication.zip
    Regards, PJ Mistry (Email: [email protected] | Web: http://www.projectsolution.co.uk | Blog: EPMGuy.com)

    Hi Mistry,
    I sure that CSOM will authenticate without passing the
    "clientContext.Credentials = Net.CredentialCache.DefaultCredentials" by default. It will take the current login user credentials by default. For more details about the CSOM operations refer the below link.
    http://msdn.microsoft.com/en-us/library/office/fp179912.aspx
    -- Vadivelu B Life with SharePoint

  • Error while deleting Cash Journal (Numbering group 1001 can be used only for one CoCd and cash journal number)

    Hi,
        While i am try to delete Cash Journal system throws me error (Message No.:FCJ065: Numbering group 1001 can be used only for one Co. Code  and Cash Journal). Kindly provide me solution on that.
    Regards,
    Tarak

    Hi Tarak,
    You can use the config nodes in SPRO to set up number ranges for your cash journal documents.
    IMG Path> FI Global Settings>Bank Accounting>Business transactions>Cash Journal
    Define Number Range Intervals for cash Journal documents
    Define Numbering Groups
    Define Number Ranges for numbering groups
    After defining the number group here, you assign that in "Set up Cash Journal" Check if there is any clash anywhere in your configuration for different cash Journals.
    Regards,
    Kavita

Maybe you are looking for