Summary of common UI Methods --- UILabel UITextField (continuously updating) and uilabeluitextfield
UILabel: UIView <NSCoding>
1. Create a UILabel object
UILabel * label = [[UILabelalloc] initWithFrame: CGRectMake (30,30, 280,60)];
2. backgroundColor
Background Color
3. text
Displayed text information
Eg: label. text = @ "displayed text ";
4. textColor
Text color
Eg: label. textColor = [UIColoryellowColor];
5. shadowColor
Text shadow color
Eg: label. shadowColor = [UIColorblueColor];
6. shadowOffset
Text shadow offset
Eg: label. shadowOffset = CGSizeMake (3, 3 );
7. textAlignment
Text format processing (alignment)
Eg: label. textAlignment = NSTextAlignmentCenter;
8. lineBreakMode
When the text is too long, the label displays the broken line mode.
Eg: label. lineBreakMode = NSLineBreakByTruncatingHead;
9. numberOfLines
Control the number of lines displayed by the label
Eg: label. numberOfLines = 0;
10. font
Font size: default font size: 17
Eg: label. font = [UIFontsystemFontOfSize: 20];
UITextField: UIControl <UITextInput, NSCoding>
1. Create a UITextField object
UITextField * name = [[UITextFieldalloc] initWithFrame: CGRectMake (30,100,280, 30)];
2. placeholder
The default placeholder string is automatically hidden once input.
Eg: name. placeholder = @ "Enter here ";
3. secureTextEntry
Input to Black Point
Eg: name. secureTextEntry = YES;
4. keyboardType
Change the keyboard type
Name. keyboardType = UIKeyboardTypeASCIICapable;
5. borderStyle
Appearance Control
Name. borderStyle = UITextBorderStyleRoundedRect;
6. clearButtonMode
Clear button
Name. clearButtonMode = UITextFieldViewModeWhileEditing;
7. backgroundColor
Background Color
8. Reclaim the keyboard
[TextField resignFirstResponder];
9.-(BOOL) textFieldShouldBeginEditing :( UITextField *) textField;
// Whether input is allowed
10.-(BOOL) textField :( UITextField *) textField shouldChangeCharactersInRange :( nsange) range replacementString :( NSString *) string;
// Restrict input characters
Eg: if ([stringisEqualToString: @ "a"]) {
ReturnNO;
}
NSLog (@ "% @", string );
ReturnYES;
11.-(BOOL) textFieldShouldReturn :( UITextField *) textField;
// Return button call Method
What is the difference between UITextField UILabel in IOS? UITextField inherits UIControl UILabel and UIView;
UITextField can be edited and input, but UILabel cannot. When UITextField is input, a proxy responds to the operation.
I do not particularly understand what you compare them with and where you want to use them. I have a premise that you can only understand what you said.