IOS development experience sharing

Some of the experience of IOS development:

1) [Multiple Threads] iOS multithreaded note, all UI operations must be on the main thread:

.

Example: [Self PerformSelectoronmainThread: @selector (Updatethumbnail 🙂 withObject: Tmpimg Waituntone: false];

2) [Design] three20 is a heavyweight framework, almost the UI component of IOS, use it to be cautious!

3) [Design] SINGLE UIVIEWCONTROLLLLER OR MUTIPLE UIVIEWCONTROLLER, NEED Think ~

4) [UI] Get the current direction of the iPad / iPhone:

UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; if (orientation == UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown) {… …} else {… …}

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

// needs to be released in the object space viewDidLoad in alloc or new in here – (void) viewDidUnload {[_sushiTypes release]; _ sushiTypes = nil;} – (void) dealloc {[_sushiTypes release]; _ sushiTypes = nil; [super dealloc ];

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 m on on d…

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 itemization.

* Forward Declarations for Everything else.

IF you do forward Declaration in The Implementation Files, Then You Probably Do Something Wrong.

7) [UIWebView] UIWebView and interaction between the application http://stackoverflow.com/questions/3738212/getting-Objective-c-to-talk-to-javascript-with-uiwebview/3738235#3738235 wrote

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 loops for.

(Althi I Would Ask you why you want to generate pop-ups like this. My Gut Feeling Tells me That this will look and feel qite 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] Since the UI operation is non-thread secure (need to be executed on the main thread), try to minimize the asynchronous UI operation. If the interface is more complicated, you can consider using UiWebView

10) [TIP] Good posts to Solve Library Sharing Between Multiple OSX / IOS Projects.

http://zetetic.net/blog/2010/02/15/20ing-static-libraries-to-share-code-on-iphone-and-mac-os-X-PROJECTS/

Can be reused between IOS and OSX

Use C to write the feasibility of 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 Implement 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] Let UiWebView support GESTURE

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

12) [UI, TIP] Location of the image of the text on the button

Set the imageedgeinset and titleedgeinset to move the component..

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

13) [UI Layout] a good example of the dynamic layout

Three20: TTStyledLayout.m

– (void) LayoutText: (TTStyledTextNode *) TextNode Container: (TTSTYLEDELEMENT *) ELEMENT {

In the future, add it ~

14) [UI Tabbar] RaisedCentertabbar

http://idevrecipes.com/2010/12/16/raded-center-tab-bar-button/

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

15) [ERROR] “WAIT_FENCES: FAILED TO RECEIVE: 10004003”?

Change the elements 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 to generate new objects in ViewDidLoad, if anyone needs to be release in viewdidunload; because Memory Warning will trigger viewdidunload, ViewDidLoad will be called multiple times.

—- In ViewDidLoad, Alloc, then Release Release is more correct memory management in ViewDidunload. In response to this situation, you need to reply to the status of ViewDidLoad, so you need to use a data model to record the status of the View.

REFERENCE:

http://stackoverflow.com/

http://www.raywenderlich.com/

Related Posts