Skip to content
This repository was archived by the owner on Oct 30, 2018. It is now read-only.

Commit e94da49

Browse files
author
Ignacio Romero Zurbuchen
committed
Update README.md
1 parent c49e2b8 commit e94da49

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

README.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ This library is used in Slack's iOS app. It was built to fit our needs, but is f
3535
- [Inverted Mode](https://github.com/slackhq/SlackTextViewController#inverted-mode) for displaying cells upside-down (using CATransform) -- a necessary hack for some messaging apps. `YES` by default, so beware, your entire cells might be flipped!
3636
- Tap Gesture for dismissing the keyboard
3737
- [Panning Gesture](https://github.com/slackhq/SlackTextViewController#panning-gesture) for sliding down/up the keyboard
38+
- [Hiddable TextInputbar](https://github.com/slackhq/SlackTextViewController#hiddable-textInputbar)
3839
- [Dynamic Type](https://github.com/slackhq/SlackTextViewController#dynamic-type) for adjusting automatically the text input bar height based on the font size.
3940
- Bouncy Animations
4041

@@ -139,14 +140,11 @@ You must first register all the prefixes you'd like to support for autocompletio
139140
#### 2. Processing
140141
Every time a new character is inserted in the text view, the nearest word to the caret will be processed and verified if it contains any of the registered prefixes.
141142
142-
Once the prefix has been detected, `-canShowAutoCompletion` will be called. This is the perfect place to populate your data source, and return a BOOL if the autocompletion view should actually be shown. So you must override it in your subclass, to be able to perform additional tasks. Default returns NO.
143+
Once the prefix has been detected, `-didChangeAutoCompletionPrefix:andWord:` will be called. This is the perfect place to populate your data source and show/hide the autocompletion view. So you must override it in your subclass, to be able to perform additional tasks. Default returns NO.
143144
144145
````objc
145-
- (BOOL)canShowAutoCompletion
146+
- (void)didChangeAutoCompletionPrefix:(NSString *)prefix andWord:(NSString *)word
146147
{
147-
NSString *prefix = self.foundPrefix;
148-
NSString *word = self.foundWord;
149-
150148
self.searchResult = [[NSArray alloc] initWithArray:self.channels];
151149
152150
if ([prefix isEqualToString:@"#"])
@@ -160,13 +158,15 @@ Once the prefix has been detected, `-canShowAutoCompletion` will be called. This
160158
self.searchResult = [self.searchResult sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
161159
}
162160
163-
return self.searchResult.count > 0;
161+
BOOL show = (self.searchResult.count > 0);
162+
163+
[self showAutoCompletionView:show];
164164
}
165165
````
166166
167167
The autocompletion view is a `UITableView` instance, so you will need to use `UITableViewDataSource` to populate its cells. You have complete freedom for customizing the cells.
168168
169-
You don't need to call `-reloadData` yourself, since it will be called automatically if you return `YES` in `-canShowAutoCompletion` method.
169+
You don't need to call `-reloadData` yourself, since it will be invoked automatically right after calling the `-showAutoCompletionView` method.
170170
171171
#### 3. Layout
172172
@@ -247,6 +247,14 @@ You can also dismiss it by calling `[self.typingIndicatorView dismissIndicator];
247247
248248
Dismissing the keyboard with a panning gesture is enabled by default with the `keyboardPanningEnabled` property. You can always disable it if you'd like. You can extend the `verticalPanGesture` behaviors with the `UIGestureRecognizerDelegate` methods.
249249
250+
###Hiddable TextInputbar
251+
252+
Sometimes you may need to hide the text input bar.
253+
Very similar to `UINavigationViewController`'s API, simple do:
254+
```objc
255+
[self setTextInputbarHidden:YES animated:YES];
256+
```
257+
250258
###Shake Gesture
251259

252260
![Shake Gesture](Screenshots/screenshot_shake-undo.png)

0 commit comments

Comments
 (0)