Beginner iOS encounters a problem record 01

Source: Internet
Author: User

Just contacted iOS and spent some time looking at my base part of OC after

Just want to try to get a small program, so see http://www.cnblogs.com/LooDo/p/3907064.html blog post small program, Bo Master analysis is very detailed, oneself also want to practiced hand try, met

Application windows is expected to has a root view controller at the end of application launch

This problem, has been debugging code.

Reason for the blame:

The version of Xcode used by bloggers is version 4.2, and I'm a novice to buy Mac Pro with Xcode naturally also the latest 5.1 version.

Xcode 4.2 No longer supports window-based application templates for creating projects. Resulting in a newly created project in the Mainwindow.xib file The window cannot be associated with the socket variable window in the delegate. So the program runs, debugging when the value of the variable window is always empty, the following is the workaround. Follow the steps below to make the program available for debugging.

1.ctrl+n, create the window below the User Interface (select Ios->user interface->window), and name it mainwindow.xib.
2.File owner modified into uiapplication. (that is, bring up the show Identity Inspector panel and change the class of the file's owner to uiapplication in the custom class.) )


4. From the library, drag an object to add, and modify the class for the delegate class, the first automatic generation of that. (The class of the newly added object will be changed to Appdelegate)



5. Add Iboutlet to the attribute window declaration of the delegate class to connect to IB. (Appdelegate UIWindow attribute is marked as Iboutlet in the future)

namely @property (strong,nonatomic) UIWindow *window; modified to: @property (strong, nonatomic) Iboutlet UIWindow *window;

Then, set the delegate of the Mainwindow.xib Fileowner to your appdelegate. Fileowner delegate and Appdelegate (Object) connection: (blue link)


Connect the window to the outlet in your appdelegate:

That is, the Appdelegate outlets and window are connected together.
6. (As you can see, there is already a Window object, this window object is the iphone's screen.) ) to connect the Window property to the window that appears by default in IB.

7. Key one step, open the project properties, in summary below the main interface inside choose MainWindow finished.

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.