Several small pits in iOS development

Source: Internet
Author: User

1. When comparing nsstring, do not use = =, use Isequaltostring: Method

2. Do not put the animation code into the Viewdidload, but should be put into the viewdidappear

After 3.UIAlertView calls Dismisswithclickedbuttonindex, Alertview:diddismisswithbuttonindex is called by the Proxy, and Alertview: Clickedbuttonatindex will not be called

4. In the switch statement, if you declare a variable, you need to enclose the case statement with {}.

5 to use. png instead of. PNG: PNG sometimes fails.

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

7. To name your iphone's tab bar custom image, add @2x, or the image will be doubled in size.

8. Even with arc, you should assign nil to the delegate used in the Dealloc method of the view controller, or the program may crash.

9. The gesture recognition code should be put into viewdidappear instead of viewdidload.

10. Do not operate auto layout in Viewdidload, but should operate in Viewdidappear

11. When using storyboard, the View controller's init is not called.

12. When UITableView's Tableview:cellforrowatindexpath: When not called, the possible causes are two, one is nil DataSource and the other is tableview:numberofrowsinsection: Return is 0.

Several small pits in iOS development

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.