Several pitfalls in iOS development and iOS development

Source: Internet
Author: User

Several pitfalls in iOS development and iOS development

1. When comparing NSString, do not use =. Use isdomaintostring: Method

2. Do not place the animation code in viewDidLoad, but in viewDidAppear.

3. After UIAlertView calls dismissWithClickedbuttonIndex, alertView: didDismissWithButtonIndex will be called by the proxy, while alertView: clickedButtonAtIndex will not be called

4. In the switch statement, if a variable is declared, use {} to enclose the case statement.

5. Use .png instead of. PNG .. PNG sometimes becomes invalid.

6. Do not assign non-integer coordinates to the UI object; otherwise, the image may be blurred.

7. Add @ 2x to the custom image name for the tab bar of the iPhone. Otherwise, the image size will be doubled.

8. Even if you use ARC, you should assign the delegate used to nil in view controller's dealloc method; otherwise, the program may crash.

9. Put the code for Gesture Recognition in viewDidAppear instead of viewDidLoad.

10. Do not operate auto layout in viewdidload, but in viewDidAppear.

11. When storyboard is used, the view controller init will not be called.

12. When the tableView: cellForRowAtIndexPath: Of UITableView is not called, there are two possible reasons: datasource is nil, and tableView: numberOfRowsInSection: Return 0.

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.