iOS Review Notes 1:helloworld project

Source: Internet
Author: User

October 2012 to May 2013, has been doing iOS development, and then began to do with Cocos game development.

After so long, review what you have learned before.


A new project

Open Xcode, select File Project single View application, and enter the project name HELLOWOLRD, select Save path.

Save after creation is complete,



Two run

Click the triangle button in the upper left corner, the program has been running for a long time, the following interface flashed over:


Then appears:



This is to run the program with the simulator, if the idle simulator is too large to see clearly, you can click on the simulator, then window "Scale" 50%.


Three drag-in controls

1 Open the UI editor: Click the Main.storyboard file in the right, and then open



2 Drag-in button: Then in the side sidebar on the right side, select the fourth and three buttons in the upper and lower sidebar, then drag a button from the bottom sidebar to "button" in column Fourth of the top sidebar to "number".



3 splitter window: Then select the second button in the upper right corner of the top bar,



Open the following interface


4 Add button time: Click to select the button you just dragged in, and then follow CTRL, drag a line from the button position on the left Chengkou to the front of the @end in the right window, and then make the following selections:



After adding the finished code



5 Handle button Events: Then in step 3, the button's previous button restores a window.

Click Viewcontroller.mm in the left sidebar and add a line of code to the function Shownum to set the number of the desktop icon:

[UIApplication sharedapplication].applicationiconbadgenumber = 2;

After adding is complete

-(Ibaction) Shownum: (ID) Sender forevent: (Uievent *) event {    [uiapplication sharedapplication]. Applicationiconbadgenumber = 2;}

6 run, then run, run up, and you can see that there are no numbers on the HelloWorld icon:




7 go back to the desktop, then check the emulator, and then check Hardward "Home,



8 Back to the program, click HelloWorld back to the program, click the button, and then back to the desktop, when the reality comes out the numbers,



If an error occurs:

Attempting to badge the application icon but haven ' t received permission from the user to badge the application

this is because in iOS8, it is necessary to set the left icon array to get permission. Processing method:

With the file delegate.mm selected, add the code in the first function:

Uiusernotificationsettings *settings = [Uiusernotificationsettings Settingsfortypes:uiusernotificationtypebadge Categories:nil];    [[UIApplication sharedapplication] registerusernotificationsettings:settings];



iOS Review Notes 1:helloworld project

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.