Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update YYTextEditExample.m #867

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions Demo/YYTextDemo/YYTextAsyncExample.m
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ - (void)viewDidLoad {
YYFPSLabel *fps = [YYFPSLabel new];
fps.centerY = toolbar.height / 2;
fps.left = 5;
[toolbar addSubview:fps];

UILabel *label = [UILabel new];
label.backgroundColor = [UIColor clearColor];
Expand All @@ -142,7 +141,6 @@ - (void)viewDidLoad {
[label sizeToFit];
label.centerY = toolbar.height / 2;
label.left = fps.right + 10;
[toolbar addSubview:label];

UISwitch *switcher = [UISwitch new];
[switcher sizeToFit];
Expand All @@ -155,7 +153,19 @@ - (void)viewDidLoad {
if (!self) return;
[self setAsync:switcher.isOn];
}];
[toolbar addSubview:switcher];


if ([UIVisualEffectView class]) {
UIVisualEffectView *effectView = (UIVisualEffectView *)toolbar;
[effectView.contentView addSubview:fps];
[effectView.contentView addSubview:label];
[effectView.contentView addSubview:switcher];

}else{
[toolbar addSubview:fps];
[toolbar addSubview:label];
[toolbar addSubview:switcher];
}
}

- (void)setAsync:(BOOL)async {
Expand Down
29 changes: 23 additions & 6 deletions Demo/YYTextDemo/YYTextEditExample.m
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ - (void)viewDidLoad {
label.text = @"Vertical:";
label.size = CGSizeMake([label.text widthForFont:label.font] + 2, toolbar.height);
label.left = 10;
[toolbar addSubview:label];


_verticalSwitch = [UISwitch new];
[_verticalSwitch sizeToFit];
Expand All @@ -99,15 +99,15 @@ - (void)viewDidLoad {
_self.exclusionSwitch.enabled = !switcher.isOn;
_self.textView.verticalForm = switcher.isOn; /// Set vertical form
}];
[toolbar addSubview:_verticalSwitch];


label = [UILabel new];
label.backgroundColor = [UIColor clearColor];
label.font = [UIFont systemFontOfSize:14];
label.text = @"Debug:";
label.size = CGSizeMake([label.text widthForFont:label.font] + 2, toolbar.height);
label.left = _verticalSwitch.right + 5;
[toolbar addSubview:label];


_debugSwitch = [UISwitch new];
[_debugSwitch sizeToFit];
Expand All @@ -118,15 +118,15 @@ - (void)viewDidLoad {
[_debugSwitch addBlockForControlEvents:UIControlEventValueChanged block:^(UISwitch *switcher) {
[YYTextExampleHelper setDebug:switcher.isOn];
}];
[toolbar addSubview:_debugSwitch];


label = [UILabel new];
label.backgroundColor = [UIColor clearColor];
label.font = [UIFont systemFontOfSize:14];
label.text = @"Exclusion:";
label.size = CGSizeMake([label.text widthForFont:label.font] + 2, toolbar.height);
label.left = _debugSwitch.right + 5;
[toolbar addSubview:label];


_exclusionSwitch = [UISwitch new];
[_exclusionSwitch sizeToFit];
Expand All @@ -136,9 +136,26 @@ - (void)viewDidLoad {
[_exclusionSwitch addBlockForControlEvents:UIControlEventValueChanged block:^(UISwitch *switcher) {
[_self setExclusionPathEnabled:switcher.isOn];
}];
[toolbar addSubview:_exclusionSwitch];



if ([UIVisualEffectView class]) {
UIVisualEffectView *effectView = (UIVisualEffectView *)toolbar;
[effectView.contentView addSubview:label];
[effectView.contentView addSubview:_verticalSwitch];
[effectView.contentView addSubview:label];
[effectView.contentView addSubview:_debugSwitch];
[effectView.contentView addSubview:label];
[effectView.contentView addSubview:_exclusionSwitch];
}else{
[toolbar addSubview:label];
[toolbar addSubview:_verticalSwitch];
[toolbar addSubview:label];
[toolbar addSubview:_debugSwitch];
[toolbar addSubview:label];
[toolbar addSubview:_exclusionSwitch];
}

[[YYTextKeyboardManager defaultManager] addObserver:self];
}

Expand Down