修改UI
This commit is contained in:
@@ -346,10 +346,28 @@ static inline NSString *KBTrimRight(NSString *s) {
|
||||
if (ivc) {
|
||||
id<UITextDocumentProxy> proxy = ivc.textDocumentProxy;
|
||||
if ([proxy conformsToProtocol:@protocol(UITextDocumentProxy)]) {
|
||||
NSString *context = proxy.documentContextBeforeInput ?: @"";
|
||||
for (NSUInteger i = 0; i < context.length; i++) {
|
||||
// 若用户把光标放在中间,需要同时删掉光标前后的内容再插入分片
|
||||
BOOL canAdjustCaret = [proxy respondsToSelector:@selector(adjustTextPositionByCharacterOffset:)];
|
||||
if (canAdjustCaret) {
|
||||
NSString *contextAfter = proxy.documentContextAfterInput ?: @"";
|
||||
while (contextAfter.length > 0) {
|
||||
NSInteger offset = (NSInteger)contextAfter.length;
|
||||
[proxy adjustTextPositionByCharacterOffset:offset];
|
||||
for (NSUInteger i = 0; i < contextAfter.length; i++) {
|
||||
[proxy deleteBackward];
|
||||
}
|
||||
contextAfter = proxy.documentContextAfterInput ?: @"";
|
||||
}
|
||||
}
|
||||
|
||||
NSString *contextBefore = proxy.documentContextBeforeInput ?: @"";
|
||||
while (contextBefore.length > 0) {
|
||||
for (NSUInteger i = 0; i < contextBefore.length; i++) {
|
||||
[proxy deleteBackward];
|
||||
}
|
||||
contextBefore = proxy.documentContextBeforeInput ?: @"";
|
||||
}
|
||||
|
||||
if (rawText.length > 0) {
|
||||
[proxy insertText:rawText];
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
@implementation KBGuideKFCell
|
||||
|
||||
- (void)setupUI {
|
||||
self.contentView.backgroundColor = [UIColor colorWithWhite:0.96 alpha:1.0];
|
||||
|
||||
self.contentView.backgroundColor = [UIColor clearColor];
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
[self.contentView addSubview:self.avatarImageView];
|
||||
[self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.contentView).offset(16);
|
||||
|
||||
@@ -16,7 +16,9 @@
|
||||
@implementation KBGuideUserCell
|
||||
|
||||
- (void)setupUI {
|
||||
self.contentView.backgroundColor = [UIColor colorWithWhite:0.96 alpha:1.0];
|
||||
self.contentView.backgroundColor = [UIColor clearColor];
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
|
||||
|
||||
[self.contentView addSubview:self.avatarImageView];
|
||||
[self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
|
||||
@@ -35,8 +35,8 @@
|
||||
|
||||
[self.searchButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.equalTo(self.bgView);
|
||||
make.right.equalTo(self.bgView).offset(-8);
|
||||
make.width.mas_greaterThanOrEqualTo(84);
|
||||
make.right.equalTo(self.bgView).offset(-4);
|
||||
make.width.mas_equalTo(84);
|
||||
make.height.mas_equalTo(32);
|
||||
}];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user