This shows you the differences between two versions of the page.
objective-c:uikit.framework:uilabel.h:init [2012/12/30 19:42] Mo created |
objective-c:uikit.framework:uilabel.h:init [2024/02/16 01:12] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | =====init===== | ||
+ | <code objc> | ||
+ | |||
+ | - (id)init; | ||
+ | |||
+ | </code> | ||
+ | |||
+ | Returns a UILabel. | ||
+ | |||
+ | **Return Value** | ||
+ | - UILabel | ||
+ | |||
+ | |||
+ | ===== ObjC Sourcecode Example ===== | ||
+ | |||
+ | <code objc> | ||
+ | |||
+ | // ** Init label ** | ||
+ | UILabel *aLabel = [[UILabel alloc]init]; | ||
+ | |||
+ | // ** Output ** | ||
+ | NSLog(@"%@", aLabel); | ||
+ | |||
+ | </code> | ||
+ | |||
+ | If you look at the output for this example code, you`ll see that the label`s frame values are "0 0 ; 0 0"! | ||
+ | This is because no frame was set yet. You need to set the frame of the label or it will not be visible after adding it to the view.\\ | ||
+ | It`s recommend to use "[[objective-c:uikit.framework:uilabel.h:initwithframe|initWithFrame]]". | ||
+ | |||
+ | |||
+ | ==== Output for this example code ==== | ||
+ | <code> | ||
+ | |||
+ | 2012-12-30 19:30:29.866 UILabelSample[1427:11303] <UILabel: 0x7414fc0; frame = (0 0; 0 0); clipsToBounds = YES; userInteractionEnabled = NO; layer = <CALayer: 0x7415080>> | ||
+ | |||
+ | </code> |