Sagit.Framework For IOS automatic layout tutorial: 12. Special usage of uibutton, uilabel, uitextfield, uitextview

Time:2020-10-22

preface:

This article introduces the common functional usage of some elements.

1. Uibutton special usage: the countdown is displayed on the button.

Basic definition

//! when button dynamically sets the text or picture, the width is adaptive
-(UIButton*)stWidthToFit;
//! displays the countdown state (seconds) of NS. When the time is up, the initial text will be restored by default
-(UIButton*)showTime:(NSInteger)second;
//! display the countdown state of NS (seconds) resetstateonend yes
-(UIButton *)showTime:(NSInteger)second resetStateOnEnd:(BOOL)resetStateOnEnd;

Special instructions:

For clicking the button to send the verification code, there is a countdown of N seconds. This function has been provided.

2. Uilabel special usage: long press to copy text content.

Basic definition

#Pragma mark extends system events
-(UILabel*)longPressCopy:(BOOL)yesNo;
//! copy text
-(UILabel*)copy;

Special note: the framework realizes the function of long press prompt to copy text.

3. Uitextfile single line input special usage: length limit, add text modification event.

Basic definition

typedef void (^OnTextFieldEdit)(UITextField*textField,BOOL isEnd);
@property (nonatomic,copy) OnTextFieldEdit onEdit;
#Custom addition system of pragma mark
//! the maximum length specified by the text (you can't enter more than this length)
-(NSInteger)maxLength;
//! specify the maximum length of the text (beyond which you can no longer enter content)
- (UITextField*)maxLength:(NSInteger)length;

4. Uitextview multi line input special usage: length line limit, text modification event(The text box changes and keyboard bounce events are handled

Basic definition

typedef void (^OnTextViewEdit)(UITextView*textView,BOOL isEnd);
@property (nonatomic,copy) OnTextViewEdit onEdit;
#Custom addition system of pragma mark
//! maximum length of text box
-(NSInteger)maxLength;
- (UITextView*)maxLength:(NSInteger)length;

//! maximum number of lines in text box (PX)
- (NSInteger)maxRow;
- (UITextView*)maxRow:(NSInteger)num;

 

Recommended Today

How to import application service in Choerodon platform

Through the previous article “the application life cycle management of the Choerodon pig toothed fish practice”, we have a basic understanding of the characteristics of application services and microservice architecture in the Choerodon platform. On this basis, this paper will introduce the function of importing application services in the Choerodon platform. Background of importing application […]