In this last period I worked on three applications for Apple iPhone, virtually simultaneously. Two have already been approved by Apple and are located on the App Store: thefirst and iMakeLove .
In both applications have adopted the use of an object UIWebView to display the instructions.
The object UIWebView ilevato was really comfortable in this case. It allowed me to quickly view and a nice text, images, and accompanied, if anything else is displayed on a Web page (Flash on iPhone not included).

The object UIWebView is really versatile and needs very few settings to be used. The only defect is the presence of a mysterious shadow that appears when you make a scroll out of the area of control is at the bottom than at the top:

After several searches I realized that this behavior depends on the SDK, especially the latest updates. And Apple has not released any official statement on how to remove it, on the contrary, he rejected as code is not allowed a series of hacks that make use of sensitive functions, or documenting. Eventually I gave up, both in terms of time, and because the solutions seemed all out of the box Apple.
Fortunately I got the solution, I hope fairly regular basis, which seems to solve the problem (thanks to Adolfo ):
1 2 3 4 5 6
| / / WebView is the control UIWebView [ webView.subviews objectAtIndex : 0 ] ; id = scroller [webView.subviews objectAtIndex: 0];
UIView * subView in [ scroller subviews ] ) for (UIView * subView in [scroller subviews]) subView class ] description ] isEqualToString : @ "UIImageView" ] ) if ([[[subView class] description] isEqualToString: @ "UIImageView"]) ; subView.hidden = YES; |
As pointed out by Adolfo , however this is a hack that may stop working with future releases of the SDK.
Continued ...
After explaining how to locate our strings in Xcode , it is easy to see now how - by applying the same technique - to locate and view images / interfaces created with Interface Builder.
Locate graphics resources
The process, as mentioned, is the same, if we have an image already included in our resources, or they insert a new one, and we want to "locate" - that is, to manage two or more images based on the languages supported - just click the button Right image ( Adium.png in this example) and select Get Info:

Make File Localizable we click in the lower left.

We click on Add and insert Localization Italian :

In order to obtain:

esattamente come accadeva con il testo: Our image is moved (physically, one of the rare times when that happens nell'alberatura Xcode is reflected on the filesystem) under virtual folders English.lproj and Italian.lproj exactly as happened with the text:

contiene una stessa versione dell'immagine. At this point each of the folders English.lproj and Italian.lproj contains the same version of the image. This image is manipulated in Interface Builder, where we will see - by default - the English version.
At this point, just overwrite one (or both files Adium.png ) to obtain a location of images "flash".
Locate the files XIB
Even the interfaces built with Interface Builder can be located in their entirety, when it is deemed necessary. ) con interfaccia XIB , lo selezioniamo, scegliamo Get Info dal menu contestuale, rendiamo il file localizzabile, aggiungiamo la localizzazione in italiano: The procedure is identical to that performed with the graphical capabilities: add a ViewController (eg infoViewController ) XIB interface, we select it, choose Get Info from the contextual menu, give the file localizable, add the Italian localization:

Clicking Italiano or Italian will open Interface Builder! ) all'interno della classica cartella Classes . This time, the filesystem, you will notice that you have created two directories ( English.lproj and Italian.lproj ) within the classical Classes folder. Both will have their files infoViewController.xib . The comfort in this, clearly resolved in the code, and when we're going to instantiate our controller code we will have a "clean" like this:
1 2
| [ InfoViewController alloc ] ; InfoViewController * info = [InfoViewController alloc]; info.view ] ; [Self.view addSubview: info.view]; |
As you can see there is no trace of any statement concerning the location, totally managed by the system. The two interfaces, of course, can be completely different, as are in effect as two separate XIB file.
Continued ...
Even in the most simple tutorial you can find the use of protocols. It will certainly happen to many in your view controller to use a protocol, inputting, next to the definition of the interface, a statement similar to:
1 2 3
| UIViewController <uiwebviewdelegate> { @ Interface myViewController: UIViewController {<uiwebviewdelegate> ... } |
Continued ...
I've had to fix an annoying problem on a WordPress blog: users left comments with long sentences. This produced the release of the text, both in the backend, even worse, in the frontend. The effect was really horrible and to avoid hand-to moderate every single comment, the only solution was to filter out - somehow - the output of the comments.
Continued ...
Perhaps I should write "Very very very, short snippets", however, is an excellent and convenient "trick" to show what I am. Running the "two" lines of code shown below, you can get the output of any URL and manipulate it.
Continued ...
jQuery is up to version 1.4! In addition to several new features and the "usual" rewrite of the code, all documentation has been revised in a very readable than before. impostato a _blank ! But we see the issue of this post; problem: add, using jQuery, a class of all tags a possessing the attribute target set to _blank !
Continued ...
The information about a user or author of a WordPress blog can be extended easily. This could for example be useful to insert the date of birth, bibliographic information, the address of the workplace or, extremely comfortable, a camp for special permission - to check later in the template.
The operation you are going to do does not require a plugin, but the code you need can be placed in the - usual - file functions.php .
Continued ...
Sometimes you just move an item, changing the point of view, to solve a problem seems insurmountable. When one has to do with compatibility between browsers and CSS, inventing solutions "spectacular" (stunts would say) is on the agenda. , per Safari e Google Chrome. What I show you an easy way to apply rounded corners to images using -moz-border-radius , which is available for Mozilla FireFox and -webkit-border-radius , Safari and Google Chrome.
Continued ...
Execute a method after n seconds
The whole family performSelector is really interesting and can be useful in a multitude of cases. Its simplest and most common application is as follows:
1 2 3 4 5
| @selector ( myMethod ) withObject : nil afterDelay : 3 ] ; [Self performSelector: @ selector (myMethod) withObject: nil afterDelay: 3]; / / void ) myMethod { - (Void) {myMethod "Hello World!" ) ; NSLog (@ "Hello World!"); } |
However, consider that the "timer" is not accurate. This procedure, therefore, should be used when there is required a "significant" temporal precision.
Retrieve the version of the
1 2
| version = [ [ [ NSBundle mainBundle ] infoDictionary ] objectForKey : @ "CFBundleVersion" ] ; NSString * version = [[[ NSBundle mainBundle] infoDictionary] objectForKey: @ "CFBundleVersion"]; "versione = %@" , version ) ; NSLog (@ "Version =% @", version); |
YES, true or TRUE?
e TRUE sono in pratica la stessa edentica cosa: Going to comb through the Kernel Apple iPhone you can realize that YES , true , and TRUE are basically the same thing Edentia:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| / / Definition of YES # Define YES (BOOL) 1 # Define NO (BOOL) 0
/ / Definition of true # Define true 1 # Define false 0
/ / Definition of TRUE # If! Defined (TRUE) # Define TRUE 1 # Endif
# If! Defined (FALSE) # Define FALSE 0 # Endif |
At least for now ...
Vibration
1 2 3
| # Import <AudioToolbox/AudioToolbox.h> / / ; AudioServicesPlaySystemSound (kSystemSoundID_Vibrate); |
CGImageRef pointer from a UIImage
1 2 3 4
| [ UIImage imageNamed : @ "LittleHeart.png" ] ; UIImage * heart = [UIImage imageNamed: @ "LittleHeart.png"]; heart CGImage ] ; CGImageRef image = [CGImage heart]; / / The image can now be "rasterized" on a CGContextRef CGRect ) { 0 , 0 , 100 , 100 } , image ) ; CGContextDrawImage (c, (CGRect) {0, 0, 100, 100}, image); |
Animations
1 2 3 4 5
| nil context : NULL ] ; [UIView beginAnimations: nil context: NULL]; 1.5 ] ; [UIView setAnimationDuration: 1.5]; UIViewAnimationCurveEaseInOut ] ; [UIView setAnimationCurve: UIViewAnimationCurveEaseInOut]; / / ... ; [UIView commitAnimations]; |
NSLog
1 2 3
| "NSString object %@ " , myString ) ; NSLog (@ "NSString object% @", myString); "Float: %f " , myFloat ) ; NSLog (@ "float:% f", myFloat); "Integer: %i " , myInt ) ; NSLog (@ "Integer:% i", myInt); |
RGB converter UIColor
1
| # Define RGBA (r, g, b, a) [UIColor colorWithRed: r/255.0 green: blue g/255.0: b/255.0 alpha: a] |
Passing parameters to a NSTimer
Taking advantage of the parameter userInfo you can send a pointer to an object to our method invoked by timer.
1 2 3 4 5 6 7 8 9 10 11 12 13
| scheduledTimerWithTimeInterval : 1 target : self selector : @selector ( timerMethod ) userInfo : objectPointer repeats : YES ] ; [ NSTimer scheduledTimerWithTimeInterval: 1 target: self selector: @ selector (timerMethod) userInfo: objectPointer repeats: YES]; / / ... void ) timerMethod : ( NSTimer * ) timer { - (Void) timerMethod: ( NSTimer *) timer { / / Retrieve the pointer to my object timer userInfo ] ; objectPointer = [timer userInfo]; / / Or myMethod ] ; [[Timer userInfo] myMethod]; [ [ timer userInfo ] myProperty ] ; int a = [[timer userInfo] myProperty]; / / Which is the same [ objectPointer myProperty ] ; int a = [objectPointer myProperty]; } |
Running time
Here is a simple way to calculate a short time needed to check the speed of execution of the code:
1 2 3 4
| ; CFAbsoluteTime initialTime CFAbsoluteTimeGetCurrent = (); / / ... tails ; CFAbsoluteTime finalTime CFAbsoluteTimeGetCurrent = (); "Tempo trascorso %f" , finalTime - initialTime ) ; NSLog (@ "elapsed time% f", finalTime - initialTime); |
Continued ...
A little 'time ago I reported a version of a Commodore 64 emulator written in Adobe ActionScript 3.0, now in a new version :
Continued ...
Latest Comments
Giovambattista Fazioli : @ Barbara: If you mean the bottom to start writing down what it depends on where ...
Barbara : Hello, is very interesting but how do you write at the bottom instead of the above? Thanks
Simon : It annoys disturbed again and use that space for these things ... however it does not work ...
Giovambattista Fazioli : @ Simon: what could be due to the syntax I used, specifically for PHP 5 +,...
Simon : I tried last night putting everything into functions.php, okay, jquery forms, and tabs jQueryUI them ...