In Objective-C we have two very used to receive and send messages between classes: notifications and delegates. The difference between the two, besides being at the implementation level, substantially depends on "how" - objects - can receive a message. First let me show how the concept was born of delegate.
Articles Tagged 'class'
Objective-C: Notifications and Delegates
How to create your own protocol with delegated
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> ... } |
How to select a group of tags that do not have children of a certain type
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 !
iPhone: extend a class UIView
creato. I want to show how you can, easily and quickly extend a class UIView in a way that responds to a new initialization method contains additional code to customize the object UIView created. As some of you probably know, Objective-C does not support a single manufacturer as in other object oriented languages (such as Adobe ActionScript or PHP 5). It 'can, in fact, create an instance of a class manually invoking different manufacturers (virtually infinite). . Normally we are used to create objects UIView with the classic initWithFrame . But imagine you want to create a new class of visual objects, from a UIView , with some additions, such as a built-in label. . Basically what we want is that instantiating our object it creates, as well as the UIView , an object of type UILabel . For example we might want to get to the end:
1 | [ [ ViewLabel alloc ] initWithLabelDefine : CGRectMake ( 0 , 0 , 320 , 80 ) label : @ "Ciao" ] ; ViewLabel vl = * [[ViewLabel alloc] initWithLabelDefine: CGRectMake (0, 0, 320, 80) label: @ "Hello"]; |
: To do this simply create a new class of type UIView and call ViewLabel :
1 2 3 4 5 6 7 8 9 10 11 12 13 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | / / / / ViewLabel.m / / # Import "ViewLabel.h" @ Implementation ViewLabel id ) initWithFrame : ( CGRect ) frame { - (Id) initWithFrame: (CGRect) frame { self = [ super initWithFrame : frame ] ) { if (self = [super initWithFrame: frame]) { / / Initialization code } return self; } / / / / Our new initializer / / id ) initWithLabelDefine : ( CGRect ) frame label : ( NSString * ) labelDefine { - (Id) initWithLabelDefine: (CGRect) frame label: ( NSString *) {labelDefine self = [ super initWithFrame : frame ] ) { if (self = [super initWithFrame: frame]) { / / Here you can decide what to do, I for / / I got the same frame security in the past / / Input but I reset the x and y ; frame.origin.x = 0; ; frame.origin.y = 0; UILabel alloc ] initWithFrame : frame ] ; internalLabel = [[UILabel alloc] initWithFrame: frame]; internalLabel.text = labelDefine; internalLabel ] ; [Self addSubview: internalLabel]; ; [InternalLabel release]; } return self; } void ) drawRect : ( CGRect ) rect { - (Void) drawRect: (CGRect) rect { / / Drawing code } void ) dealloc { - (Void) dealloc { ; [Super dealloc]; } @ End |
At the time of the creation of our new class, we could use:
1 | [ [ ViewLabel alloc ] initWithLabelDefine : CGRectMake ( 0 , 0 , 320 , 80 ) label : @ "Ciao" ] ; ViewLabel vl = * [[ViewLabel alloc] initWithLabelDefine: CGRectMake (0, 0, 320, 80) label: @ "Hello"]; |
WordPress: customize the navigation between the posts
WordPress offers many features to navigate through the various posts and pages forward and back. These are used within the themes, often in a completely interchangeable, although they contain some differences. This, in fact, create much confusion in the choice of the function to use. Here are some notes:
Actionscript 3.0 for beginners: lesson # 5
Who has started to develop code with scripting languages such as JavaScript or ActionScript the same, may not know all the concept of data type. With some high-level languages, in fact, it used to - at best - to declare variables without giving a specific data type, not counting those languages that do not require any statement (such as PHP - not in the strict version 5 ).
Very short trick: ADDED_TO_STAGE
per capire quando il nostro MovieClip è disegnato effettivamente sulla stage: As we have seen several times in the constructor of a class that extends MovieClip may be necessary to add the event ADDED_TO_STAGE to understand when our MovieClip is actually drawn on the Stage:
Very short snippet: jQuery auto target blank link
Nothing new, but the sign to remind me: how to add an image to all the links that open a new page:
1 | ) . addClass ( 'external' ) ; jQuery ('a [@ target = _blank]'). addClass ('external'); |
Actionscript 3.0 for beginners: lesson # 4
Recall the example of our code of TicTacToe (found in full on Google Code ) and begin to analyze it in detail.
Import definitions
With Actionscript 3.0 has done a great job of cleaning and accommodation nell'alberatura classes (contained in the packages, package ) used during development. In other programming languages, like C for example, when you want to use a feature must explicitly "import" in the code. This operation of "import" is necessary to allow the compiler to have all the codes and definitions related to the features we want to use. ; Actionscript 3.0 mette a disposizione l'istruzione include che è identica all' #include del C/C++. In ActionScript 3.0, however, education import should not be confused with the equivalent C / C + + #include , Actionscript 3.0 provides education include that is identical to ' #include in C / C + +. The latter, in fact, "include" the actual code that, if used or not, the final executable is compiled. The statement import is the highest level and is more "intelligent" at compile time. It is used primarily for access classes without specifying their full name. In alre words instead of using forms such as:
1 |
Very short trick: versatility of CSS classes
nei fogli di stile CSS. Most experts will know already, but I am often asked what is the difference between class and id in the CSS. , è la possibilità di usare classi multiple. An overview of some differences and warnings can be found on the Class and ID in CSS , however, a useful feature that distinguishes class from id , is the ability to use multiple classes.






Latest Comments
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 ...
Giovambattista Fazioli : @ Simon: I recommend cleaning to enter a code like that in ...
Simon : @ Giovambattista Fazioli: Thank you for your patience, it's all clear ... now I feel now, ...