Highlights of iOS development issues (2)

Source: Internet
Author: User

The office machines were originally used by others, while Xcode was also downloaded by another user's account. When I tried to upgrade Xcode yesterday, I found that there was no password. In order not to disturb others, but to make it easier for me to upgrade it, I just uninstalled the old version and downloaded the new version 4.6.

After the download is complete, the problem occurs. Some previously configured Xcode settings are missing, so you have to reset the settings. Your memory is not good. Record it here so that you can find the same problem in the future. Temporary problems:

1. The Code style has changed. The Default value is Basic. Reset to Default based on your preferences, as shown in:

Comparison between the preceding and preceding settings:

Before setting

After setting

You can also set it to something else based on your preferences.

2. The view on the. xib file does not automatically display the virtual border. For convenience, you need to set it manually. The setting method is Editor-> Canvas-> Show Bounds Rectangles, as shown in:

Comparison between the preceding and preceding settings:

Before setting

After setting

These problems are encountered temporarily. If there are new settings, add them. The following are some other issues.

3.1 What is the difference between UIBarButtonItem and NavigationItem?

UIBarButtonItem is included in NavigationItem, which is the buttons left and right of the navigation bar.

NavigationItem is a container that can hold left and right buttons, return keys, and title views.

3.2, [self. navigationBar addSubView: lable]; are they equivalent to self. navigationItem. titleView = label?

If you do not answer this question, you will be able to give it a try. If you encounter problems, you can practice more, write more code, and try it again. The memory is profound.

4. How do I display the number of the circular background in the upper left corner of the icon in the app?

ApplicationDidEnterBackground in AppDelegate. m: The actual method is as follows:

- ()applicationDidEnterBackground:(UIApplication *

5. How to Use the NSClassFromString class?

NSClassFromString is a very useful thing, especially in the development of the iPhone toolchain.

Normally,

 myObj = [[NSClassFromString() alloc] init];

And

 myObj = [[MySpecialClass alloc] init];

Is the same. However, if the class MySpecialClass does not exist in your program, the following write method will fail, and the above method only returns an empty object.

Therefore, in some cases, you can use NSClassFromString to initialize uncertain classes.

For example, SKStoreProductViewController may be used in the iPhone. Therefore, when you need to use SKStoreProductViewController,

Best Practice: [[NSClassFromString (@ "SKStoreProductViewController") ......]

Instead of using the [SKStoreProductViewController...] method directly, because SKStoreProductViewController is not supported in versions earlier than iOS6.

The advantages of NSClassFromString are:

A weakens the connection, so no Framework is linked to the program.

B does not need to use import, because classes are dynamically loaded and can be loaded as long as they exist. Therefore, if your toolchain does not have a header file definition for a class and you are sure that this class is usable, you can also use this method.

6. The flash on the back of the iPhone keeps flashing.

Select general in the settings, select the auxiliary function, and then turn off the LED flashing.

7. How does TBXML traverse specified elements?

- () traverseElement:(TBXMLElement *        NSLog(        TBXMLAttribute * attribute = element->                    NSLog(            attribute = attribute->         (element->firstChild) [self traverseElement:element->    }  ((element = element->

7. How can I cancel the UITextAlignmentCenter warning? Annoying... for example:

Modify UITextAlignmentCenter to NSTextAlignmentCenter

 

Copyright statement: This article by http://wzrong.cnblogs.com or http://iostour.diandian.com original, welcome to repost share. Please respect the work of the author. Keep this note and the author's blog link when reprinting. Thank you!

 

 

Original article. If you need to reprint it, please indicate the source. Thank you!

You are welcome to visit our technical microblog @ iOS to learn from each other and make progress together!

Welcome to my weibo @ Wei zhirong

 

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.