2 3 Page 1 of 3 1 2 3

setAnimationDidStopSelector: various applications and advanced

Monday, March 8, 2010

In most cases, either because we are used or because we have seen in tutorials and in some text to setAnimationDidStopSelector like this: PLAIN TEXT Objective-C: [UIView beginAnimations: nil context: NULL], [UIView setAnimationDuration: 1.5 ] [UIView setAnimationCurve: UIViewAnimationCurveEaseInOut] [UIView setAnimationDelegate: self], [UIView setAnimationDidStopSelector: @ selector (removeView)]; myView.alpha = 0; [UIView commitAnimations] / / - (void) (removeView [MyView removeFromSuperview] ;) The code above sets the setAnimationDelegate self as delegate and through [...]

How to locate images and views in Interface Builder

Tuesday, February 23, 2010

After explaining how to locate our strings in Xcode, as we see now is simple - using the same technique - locate images / views / interfaces built with Interface Builder. Locate graphics resources process, as mentioned, is the same, if we have a ' image already included in our resources, or places a new, and we want to "locate" - that is [...]

How to create your own protocol with delegation

Wednesday, February 10, 2010

Create your own protocol may be useful in a host of cases

Very short snippet: get the output of a URL in Objective-C

Friday, February 5, 2010

Perhaps I should have written "Very very very, short snippets," but it is an excellent and convenient "trick" that I am about to show. Doing the "two" lines of code shown below, you can get the output of any URL and manipulate it. PLAIN TEXT Objective-C: NSString * url = [NSString stringWithFormat: @ "http://www.appleside.it/ "]; NSString * result = [NSString stringWithContentsOfURL: [NSURL URLWithString: url] [...]

Objective-C: Expose properties in a class

Monday, December 14, 2009

I would like to show and discuss some examples on how to add and manipulate properties in a Class Objective-C. A classic example, precisely, is as follows: in the definition of our interface class defines two properties name: PLAIN TEXT Objective-C: / / MyClass.h <Foundation/Foundation.h> # import @ interface MyClass : NSObject (NSString * name; NSString * name;) @ property (retain) NSString * name; @ property (retain) NSString [...]

Very short snippet: Apple iPhone file system

Saturday, November 21, 2009

Both Mac OS X and iPhone OS, we can have easy and direct to the directories - more important - the system which are: PLAIN TEXT CODE: NSHomeDirectory Returns the path to the current user's home directory. NSHomeDirectoryForUser Returns the path to a given user's home directory. NSTemporaryDirectory Returns the [...]

Objective-C: NSLog () on C struct

Thursday, October 29, 2009

Syntax NSLog (@"%@", ...) works and is used to obtain information about objects, but does not work on C data types like struct CGRect or CGPoint, for example. To realize NSLog (@"%@", ...), also on struct type C can rely on conversion functions as NSStringFromCGRect () or NSStringFromCGPoint: PLAIN TEXT Objective-C: CGrect mioRect = (CGRect) (10, 20,30,40); CGPoint mioPoint [...]

XCode Objective-C: Useful keyboard shortcuts

Monday, October 26, 2009

XCode is a very powerful development environment and reserves some surprises. It permits a function similar to "snippets" of the famous editor TextMate. In practice, you can insert blocks of code using the key sequence ESC + a combination of one or more sequences of characters. For example if you want to enter a block if [...]

Very short snippet: iPhone, random numbers

Friday, October 9th, 2009

If you need to generate random numbers in an application from the Apple iPhone you have to put Objective-C, because it proposes no class for this purpose. The solution is that proposed by the C: rand (), srand (), random (), srandom () and arc4random (). Of all the most popular is definitely arc4random (), because it requires no special initialization or duties of [ ...]

iPhone: Create a method to respond to events cross class

Wednesday, July 29, 2009

Normally, an event which is nothing but a message is fixed (set and implemented) in the same class or context, function or procedure "caller." For example if we add a button away UIButton code (programmatically), we can find our class inside a UIView or a UIViewController. In both cases the task allocation and [...]

2 3 Page 1 of 3 1 2 3