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: 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 [...]

iPhone SecondApp: Guess the number - Part 2

Monday, July 13, 2009

As anticipated in iPhone FirstApp: Guess the number - Part 1 we see how to make an application for Apple iPhone without using Interface Builder! Indeed, physically delete files created by Interface Builder wizard Xcode. At the end of this post, then we will have an application identical in all respects to that made in Part One, [...]

iPhone FirstApp: Guess the number - Part 1

Tuesday, June 23, 2009

The first source that I passed through the hands was written in Basic and consisted of a few lines of code, for enlightening me. It was a simple game that generates a random number from 1 to 10 and, through keyboard input, make sure the number entered was Maggioni, less than or equal to the random number. [...]

Objective-C: type conversion

Tuesday, June 23, 2009

With some high-level languages such as JavaScript or PHP, where the data is not typed or otherwise can not be, we are "spoiled" to compare or convert integers and strings, and vice versa, all hidden or manipulated by the interpreter (or compiler ). For example, in JavaScript there are functions of "forcing" (as parseInt () for example) needed in [...]