Category 'Objective-C'


Objective-C: addendum on notifications and delegates

Answer to the question of ILeW with a genuine article to better explain, attaching example , how they work and delegates notifications. Using a pattern we see first of all how the delegate pattern:

Delegate

An object in search of a delegate

Continued ...

Multiple video with AVQueuePlayer

The class MPMoviePlayerController has the major drawback of not adequately handle multiple concurrent video, in addition to making it difficult to create a sequence of video one after another. che è una sottoclasse di AVPlayer ), appartenente al framework più a basso livello AVFoundation , è invece estremamente più versatile, nonostante mantenga egualmente una semplicità nell'implementazione. The class AVPlayer (or AVQueuePlayer which is a subclass of AVPlayer ), belonging to the framework lowest level AVFoundation , is instead extremely versatile, despite maintaining also a simplicity in implementation.

Frameworks Block Diagram

Continued ...

Objective-C: how to best use the property list file

One of the advantages of the Property list files, which are nothing more than text files that follow the XML standard, is that it can be instantly transformed into objects (such as arrays or dictionary) Objective-C. When you create a file Property list:

Property List

Continued ...

Very short trick: log of JavaScript objects

If you are to develop in an environment where it is impossible to use debugging tools such as FireBug , such as the Apple iPad simulator Xcode, it can become frustrating to identify problems, one all wrong access to the properties of an object. Here the use of the works alert() becomes crucial!

Continued ...

Xcode4: code backwards compatible

Xcode 4 allows you to develop applications for iPhone or iPad with iOS 4.3 target lower than today's. However, the same code that comes with the template "flaw" of presumption, assuming that our application will target iOS 4 or above. In the application delegate, for example, Xcode inserts the following lines of code:

1
2
3
4
5
6
7
BOOL ) application : ( UIApplication * ) application didFinishLaunchingWithOptions : ( NSDictionary * ) launchOptions - (BOOL) application: (UIApplication *) application didFinishLaunchingWithOptions: ( NSDictionary *) launchOptions
{
/ / Override point for customization after application launch.
self.window.rootViewController = self.viewController;
; [Self.window makeKeyAndVisible];
; return YES;
}

Continued ...

Objective-C: notifications and delegates

In Objective-C we have two ways widely used for receiving and sending messages between classes: the notifications and delegates. The difference between the two, as well as being at the implementation level, substantially depends on "how much" - objects - can receive a message. First let me show you how does the concept of delegate.

Continued ...

Very short snippet: NSConnection in with POST parameters

che in modalità POST . The object NSMutableURLRequest can be used in either GET that mode POST . . The parameters, however, are formatted as if they were in GET , ie in the sequence nome_campo1=valore1&nome_campo2=valore2&... . Here's a handy snippet to simplify the construction of golf:

Continued ...

Objective-C: public, protected and private

I wrote a similar article for ActionScript long ago: Actionscript 3.0: public, protected, private and internal . Rereading it, I realized two things: the first was the extreme similarity with Objective-C, although the latter does not include internal .

Continued ...

iPhone FontsBook: source code to display the system font

To complete the article How to: custom fonts on iOS 3. 2 I propose the sources FontsBook , a simple iPhone application that displays in a table all system fonts, grouped by family.

FontsBookFontsBookFontsBook

Continued ...

Very short trick: how to use NSFileManager

, in quanto quest'ultimo restituisce un'instanza singleton, cioè sempre lo stesso puntatore ad oggetto (non thread safe). Apple recommends using the instance of the NSFileManager and not its meotodo class defaultManager , as the latter returns an instance singleton, that is always the same pointer to object (not thread safe).

Continued ...