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

Added support for customizing an indicator view. Defaults to the stan… #202

Closed
wants to merge 3 commits into from
Closed

Added support for customizing an indicator view. Defaults to the stan… #202

wants to merge 3 commits into from

Conversation

sveinhal
Copy link

…dard typingIndicatorView

By calling -registerClassForIndicatorView: during initialization of the view controller, you can customize the appearance and behavior of the typing indicator view.

If not called, or a subclass of SLKTypingIndicatorView is passed, -typingIndicatorView will return the typing indicator view as before. If some other subclass of UIView is passed, -typingIndicatorView will return nil, and you need to cast the return value of -indicatorView to the appropriate type in you need to interact with it directly. Setting its hidden property to either true or false, will automatically animate.

This closes #201

@sveinhal
Copy link
Author

This makes the examples work with no modification and should assure backwards compatibility. However, since the indicator view is instantiated by the view controller, and can be any UIView subclass, a consumer must have to cast the return value of indicatorView to the appropriate type. This is perhaps not optimal:

@interface MyTextViewController: SLKTextViewController
@property (nonatomic, readonly) MyTypingIndicatorView *indicatorView;
@end

@implementation MyTextViewController
@dynamic indicatorView;
- (instancetype)init {
    self = [super initWithTableViewStyle:UITableViewStylePlain];
    if (self) {
        [self registerClassForIndicatorView:[MyTypingIndicatorView class]];
    }
    return self;
}
@end

@sveinhal
Copy link
Author

This also gets away with no particular protocol or subclass, since the view controller is using KVO to listen for changes to the hidden property, and adjust the height accordingly.

…dard typingIndicatorView

By calling -registerClassForIndicatorView: during initialization of the view controller, you can customize the appearance and behavior of the typing indicator view.

If not called, or a subclass of SLKTypingIndicatorView is passed, -typingIndicatorView will return the typing indicator view as before. If some other subclass of UIView is passed, typingIndicatorView will return nil, and you need to cast the return value of indicatorView to the appropriate type in you need to interact with it directly. Setting its hidden property to either true or false, will automatically animate.
@dzenbot
Copy link

dzenbot commented Jun 18, 2015

I will have a look on this real soon! Thanks!

Svein Halvor Halvorsen added 2 commits June 19, 2015 12:58
@sveinhal
Copy link
Author

@dzenbot Do you have time for a look at this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Customizing typing indicators.
2 participants