Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Calling other methods from methods happen all the time in most programming languages. It's a great way to split code up and reuse code in different places without having to copy/paste.</p> <p>(This might be too basic for you. Sorry in that case)</p> <p>Things may be easier to understand if you use standard naming conventions too. ('likeThis' for variables and method names; 'LikeThis' for class names)</p> <pre><code>- (void)textFieldDidEndEditing:(UITextField *)textField { NSString *oldTextFieldValue = textField.text; textField.text = [NSString stringWithFormat:@"%@ %%",oldTextFieldValue]; } </code></pre> <p><code>textField</code> here, is the pointer to the UITextField object which just finished editing. You want to pass this object to your new 'other' method.</p> <pre><code>[self calculate:textField]; </code></pre> <p><code>self</code> is a pointer to an instance of the current class. For example, in a UIViewController subclass called 'MyViewController', self refers to the current instance of this class. Since the <code>-calculate</code> method is an instance method (beginning with a '-') it requires you to use <code>self</code>. The variable <code>textField</code> is passed after the colon.</p> <pre><code>- (void)calculate: (UITextField*)textField { NSString *oldTextFieldValue = textField.text; textField.text = [NSString stringWithFormat:@"%@ %%",oldTextFieldValue]; </code></pre> <p>}</p> <p>Use only the <code>IBAction</code> keyword when you want the method to be called from a UIComponent in an xib or storyboard.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload