IOS development experience sharing and ios Experience Sharing

Source: Internet
Author: User

IOS development experience sharing and ios Experience Sharing

Some IOS development experiences:

 

1) [Multiple Threads] IOS multithreading note that all UI operations must be performed on the main thread:

Any code that will update the UI shocould be done on the main thread. Data loading shocould typically be done in some background thread.

Example: [self defined mselecw.mainthread: @ selector (updateThumbnail :) withObject: tmpImg waitUntilDone: false];

 

2) [Design] Three20 is a heavyweight framework. It is almost self-implemented with ios ui components. Exercise caution when using Three20!

 

3) [Design] Single UIViewController or Mutiple UIViewController, need think ~

 

4) [UI] To get the current direction of ipad/iphone:

Objective c code  
  1. UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
  2. If (orientation = UIInterfaceOrientationPortrait | orientation = UIInterfaceOrientationPortraitUpsideDown ){
  3. ......
  4. } Else {
  5. ......
  6. }

 

5) [Memory Management] Release a variable and set it to nil is a good habit.

Objective c code  
  1. // In viewDidLoad, The alloc or new object space needs to be released here
  2. -(Void) viewDidUnload {
  3. [_ SushiTypes release];
  4. _ SushiTypes = nil;
  5. }
  6. -(Void) dealloc {
  7. [_ SushiTypes release];
  8. _ SushiTypes = nil;
  9. [Super dealloc];
  10. }

 

The http://www.raywenderlich.com/2657/memory-management-in-objective-c-tutorial wrote

Note that you also set the object to nil afterwards. this is a good practice, because by setting it to nil it avoids a lot of problems. any time you call a method on a nil object, it does nothing, but if you don't set it to nil, if you tried calling a method on a deallocated object your program shocould crash.

 

6) [Other] # import and @ class declaration usage

Http://stackoverflow.com/questions/322597/class-vs-import/1350029#1350029 wrote Three simple rules: * Only # import the super class in header files. * # import all classes you send messages to in implementation. * Forward declarations for everything else. if you do forward declaration in the implementation files, then you probably do something wrong.

 

7) [UIWebView] interaction between UIWebView and Application

The http://stackoverflow.com/questions/3738212/getting-objective-c-to-talk-to-javascript-with-uiwebview/3738235#3738235 wrote that You can send data from the Cocoa layer to the JavaScript layer by using the stringByEvaluatingJavaScriptFromString: method in UIWebView.
The Cocoa layer can also "intercept" link clicks by implementing the UIWebViewDelegate protocol in your view controller; when a link is clicked, the delegate method webView: shouldStartLoadWithRequest: navigationType: will be called, at which point the Cocoa layer can do the kind of "pop-up" action you're looking.
(Although I wocould ask you why you want to generate pop-ups like this. My gut feeling tells me that this will look and feel quite annoying from the user's point of view .)

 

8) [UI] A great article for Popoverview usage

Http://mobiforge.com/designing/story/using-popoverview-ipad-app-development

 

9) [Design] As UI operations are non-thread-safe (must be executed on the main thread), asynchronous UI operations should be minimized. If the interface is complex, you can use UIWebView.

 

10) [Tip] Good posts to solve library sharing between multiple osx/ios projects.

Http://zetetic.net/blog/2010/02/15/building-static-libraries-to-share-code-on-iphone-and-mac-os-x-projects/

Reusable code between ios and osX

The feasibility of using c to compile Android and IOS shared code

 

11) [Tip] IOS weak link frame for multiple sdk compatibility

 

Http://stackoverflow.com/questions/2627797/weak-link-framework/2629693#2629693 wrote You are getting that error because you are building against a version of the SDK that does not implemement the MessageUI framework.
What you need to do is to build for iPhone OS 3.0, but in the build settings for your target set the iPhone OS Deployment Target to iPhone OS 2.0 (or whatever minimum version you 'd like to support with your final application ). this way, you weak-link against the newer framework, but can still deploy the application to older devices.

 

11) [UI] Enable UIWebView to support Gesture

Http://justinimhoff.com/swipe-gesture-with-uiwebview/

 

12) [UI, Tip] positions of text pictures on the button

SetimageEdgeInsetAndtitleEdgeInsetTo move the components around und within your image.

Http://stackoverflow.com/questions/2515998/iphone-uibutton-image-position/2516108#2516108

 

13) A Good Example of [UI Layout] Dynamic Layout

Three20: TTStyledLayout. m

-(Void) layoutText :( TTStyledTextNode *) textNode container :( TTStyledElement *) element {

Coming soon ~

 

14) [UI TabBar] RaisedCenterTabBar

 

Http://idevrecipes.com/2010/12/16/raised-center-tab-bar-button/

Https://github.com/boctor/idev-recipes/tree/master/RaisedCenterTabBar

 

15) [Error] "wait_fences: failed to receive reply: 10004003 "?

Change the element on the view before viewDidAppear.

 

16) [Grammar] @ synthesize and @ dynamic

 

 

@ Synthesize will generate getter and setter methods for your property. @ dynamic just tells the compiler that the getter and setter methods are implemented not by the class itself but somewhere else (like the superclass)

 

17) try to avoid using alloc in viewDidLoad to generate new objects. If callback needs to be release in viewDidUnload, viewDidLoad is called multiple times because viewDidLoad is triggered when memory warning occurs.

---- Alloc in viewDidLoad and release in viewDidUnload are the correct memory management methods. In this case, you need to reply to the view status in viewDidLoad, so you need to use a data model to record the view status.


How much does one year's work experience earn from IOS Development in Beijing?

On average, more than 6 kb of work experience is required for one year.

How to Develop iOS?

Hello. For those who have no development experience, there are three steps.

Step 1: Learn the development language Objective-C. Just read the book "Objective-C basic tutorial. The book later needs to add some Object-Oriented Knowledge. Generally, computer students are familiar with this kind of thinking when learning C ++. The reference book I recommended will also provide some explanations. For advanced learning, I need to go back to the documents. There is no specific teaching material, because object-oriented programming is a kind of idea, fortunately, Objective-citself is the embodiment of this idea and will be able to understand it later when writing code. After learning "Objective-C basic tutorial", you will have an understanding of the basic data classes used in iOS development. At this time, you should be able to write simple interface-free programs.

Step 2: Learn the software running principles, software development ideas, specifications, and the usage of some commonly used standard UI (User Interface) controls provided by Apple. The reference book recommended at this stage is the basic development tutorial for iPhone 4 and iPad, which has a Chinese translation. Although it is not the latest iOS tutorial (the latest tutorial should be the basic development tutorial for iOS7, but the book does not have a Chinese translation. If it is good at English, it is of course the best to read it ).

Step 3: Be familiar with common third-party controls. Due to Apple's open limitations, the standard development library provided by Apple has some functional limitations. Smart wireless network users have developed a variety of third-party controls to implement the functions they want, the development process can get twice the result with half the effort. This part is divided into advanced learning content, which should be based on the previous two steps. This step is mainly for trial use, learning third-party code, requiring reading third-party development documents and more code. You can perform software development at the same time as development.

In addition to reference books, we recommend that you share the code of many netizens on the "Cocoachina Apple development Chinese site" and discuss the problems encountered during your study. You can find relevant learning materials and code in the Forum at the early stage, in the middle stage, and in the later stage, and get technical guidance from the experts through posting. The corresponding English website is Stackflow, which focuses on solving actual development problems. The communication language is English.

In addition, each year, Stanford University opens an Open Class for iOS development, covering from Objective-C to the use of controls, development ideas, and architecture, is a good video tutorial. In the Netease Open Class, videos with Chinese subtitles are included in previous courses, while the latest courses generally do not have Chinese subtitles. By default, students of this course already have C ++ programming basics, it may be difficult for beginners. Video is a public resource. You can search for keywords such as Stanford and iOS on the search engine to find the corresponding resource. Just a simple search, Youku has provided a high-definition video album developed by iOS7.

Finally, no matter which operating system is used for software development, the most important thing is to practice more. Therefore, it is very important to write a lot of practice code and view others' excellent code.

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.