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!


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:// 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:// 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 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


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.

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

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

Set the imageedgeinset and titleedgeinset to move the component..


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



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.


Related Posts