If you are to develop in an environment where it is impossible to use the debugging tools like FireBug , such as the Apple iPhone simulator in Xcode, it can become frustrating to find problems, including an incorrect access to all properties of an object. Here is that the use of works alert() is fundamental!
Articles Tagged 'Alert'
Very short trick: log JavaScript objects
How to develop in PHP with Xcode and Objective-C
How many programmers to use, I also build my own library of functions ready to be reused in multiple projects and multiple contexts. Let me change the title of this post, maybe a little 'risky but, nevertheless, as we shall see, not far from reality.
In Objective-C you can write and call C / C + +, including the assembly for that matter. This characteristic makes it a very versatile language and, in some respects, phenomenal. On the one hand, you can use and appreciate the purely syntax of Objective-C, on the other you can run faster porting code written in ANSI C (perhaps for Digital Unix or Sun) and can comfortably fit into our iPhone or iPad applications; not to mention all the BSD kernel is already available on Mac OS X!
iPhone code snippet: UIAlertView
The class UIAletrView allows you to display a modal window (animated) to inform and / or ask you something. The UIAlterView (view alerts) are very comfortable and easy to use. The management of user response is solved by intercepting the index of the button pressed. To view a simple UIAlterView just write:
1 2 3 4 | / / Alert with a simple button, with no callback [ [ UIAlertView alloc ] initWithTitle : @ "Titolo" message : @ "Messaggio" cancelButtonTitle : @ "Annulla" otherButtonTitles : nil ] ; UIAlertView MyAlert * = [[UIAlertView alloc] initWithTitle: @ "Title" message: @ "Message" cancelButtonTitle: @ "Cancel" otherButtonTitles: nil]; ; [MyAlert show]; ; [MyAlert release]; |
And 'possible to add additional buttons otherButtonTitles :
1 2 3 4 | / / Alert with two simple buttons, no callback [ [ UIAlertView UIAlertView MyAlert * = [[UIAlertView ; [MyAlert show]; ; [MyAlert release]; |
: To determine which button was pressed, simply add the delegate:self object initialization UIAlterView :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | / / Simple alert with two buttons and callbacks [ [ UIAlertView alloc ] initWithTitle : @ "Titolo" message : @ "Messaggio" delegate : self cancelButtonTitle : @ "Annulla" otherButtonTitles : @ "Ok" , nil ] ; UIAlertView MyAlert * = [[UIAlertView alloc] initWithTitle: @ "Title" message: @ "Message" delegate: self cancelButtonTitle: @ "Cancel" otherButtonTitles: @ "OK", nil]; ; [MyAlert show]; ; [MyAlert release]; / / The callback looks like this void ) alertView : ( UIAlertView * ) alertView clickedButtonAtIndex : ( NSInteger ) buttonIndex { - (Void) alertView: (UIAlertView *) alertView clickedButtonAtIndex: (NSInteger) {buttonIndex buttonIndex ) { switch (buttonIndex) { : case 1: / / Code break; } } |
The callback alertView need to have that name, for more information see UIAlertViewDelegate
punteranno sempre a quella. With only the callbck alertView:clickedButtonAtIndex more UIAletrView will always point to that. Using the tag of the field UIAletrView , we can determine what the "caller":
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | / / Simple alert with two buttons and callbacks [ [ UIAlertView alloc ] initWithTitle : @ "Titolo" message : @ "Messaggio" delegate : self cancelButtonTitle : @ "Annulla" otherButtonTitles : @ "Ok" , nil ] ; UIAlertView MyAlert * = [[UIAlertView alloc] initWithTitle: @ "Title" message: @ "Message" delegate: self cancelButtonTitle: @ "Cancel" otherButtonTitles: @ "OK", nil]; ; myAlertA.tag = 1; ; [MyAlert show]; ; [MyAlert release]; / / [ [ UIAlertView alloc ] initWithTitle : @ "Titolo" message : @ "Messaggio" delegate : self cancelButtonTitle : @ "Annulla" otherButtonTitles : @ "Ok" , nil ] ; UIAlertView myAlertB * = [[UIAlertView alloc] initWithTitle: @ "Title" message: @ "Message" delegate: self cancelButtonTitle: @ "Cancel" otherButtonTitles: @ "OK", nil]; ; myAlertA.tag = 2; ; [MyAlertB show]; ; [MyAlertB release]; / / Multiple management UIAlertView void ) alertView : ( UIAlertView * ) alertView clickedButtonAtIndex : ( NSInteger ) buttonIndex { - (Void) alertView: (UIAlertView *) alertView clickedButtonAtIndex: (NSInteger) {buttonIndex "Alert Tag: %i" , alertView.tag ) ; NSLog (@ "Alert Tags:% i", alertView.tag); "buttonIndex: %i" , buttonIndex ) ; NSLog (@ "buttonIndex:% i", buttonIndex); } |
Create MovieClip modal TopMost
di Flash. Illustrate a technique to create symbols (MovieClip) modal components to be used similarly to the Alert and Window of Flash. The aim is to show a MovieClip above all others, disabling - well - access to the underlying and any other object / component present. To be honest I have achieved that by doing a little 'reverse engineering code from Adobe, which is in the clear! I actually resisted ![]()
The artefizio that is used to disable any interface present below our MovieClip, is to create a transparent MovieClip take the whole area of the stage. a false . At this MovieClip, which will be virtually no visible snaps a method "void" on the event onRelease , being careful to set the useHandCursor to false .
First of all we create a movie with any interface in the main stage:







Latest Comments
Mark : @ Mark: Thanks for the answer. For example, if you have a code to save / use the folder ...
Mark : Thanks for the answer. For example, if you have a code to save / use the folder ...
Giovambattista Fazioli : @ Mark: in principle, absolutely, a lot depends on how and what to download. La. ..
Mark : Hello, good guide! I wanted to ask, you can use the same code to run a sql database? Instead of ...
Joseph : Hi I wanted to ask you how you can do in the post I uploaded a gallery of 50 images, for example, ...