IOS growth path-Get values from other classes in the appdelegate class

Source: Internet
Author: User
Tags apd

Define attributes in the appdelegate class

For example, a textdb object assigns the value to this object in other classes to use this object in the appdelegate class.

@ Class textdb; @ interface appdelegate: uiresponder <uiapplicationdelegate> {textdb * itextdb ;}

Then, in the class you want to obtain the value, write as follows:

// Define the object APD of the appdelegate class // use the following method to use this object so that the value can be uploaded to self in appdelegate. APD = (appdelegate *) [[uiapplication sharedapplication] Delegate]; // assign the textdb object in this class to the textdb object self in the appdelegate class. APD. itextdb = self. itextdb;

You can get the value of the textdb object in the appdelegate class through the two steps above.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.