Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/edufresne/blcaptionbar
BLCaptionBar
https://github.com/edufresne/blcaptionbar
Last synced: 2 months ago
JSON representation
BLCaptionBar
- Host: GitHub
- URL: https://github.com/edufresne/blcaptionbar
- Owner: edufresne
- License: mit
- Created: 2016-12-27T03:59:05.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-01-04T21:47:51.000Z (about 8 years ago)
- Last Synced: 2023-10-20T19:37:20.593Z (over 1 year ago)
- Language: Objective-C
- Size: 53.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# BLCaptionBar
This is a reusable UITextView subclass for all iOS versions that is inspired by Snapchat's caption bar. The bar can be added to any view and can be shown with a single call. BLCaptionBar works for both portrait and landscape orientations and can be customized just like UITextView such as changing background colors, text colors, opacity, and animation settings. The bar can be vertically dragged and is hidden when no text is inputted.### Example Usage ###
Below is a sample usage inside of your custom View Controller
* Swift *
```swift
var captionBar : BLCaptionBar!
override func viewDidLoad(){
super.viewDidLoad()
self.view.userInteractionEnabled = true
captionBar = BLCaptionBar()
//Customization
captionBar.animationTime = 0.35
captionBar.uiDelegate = self
self.addSubview(captionBar)
}
override func touchesEnded(touches: Set, withEvent event: UIEvent?){
captionBar.slideUp()
}
override func someOtherMethod(){
captionBar.slideDown()
}
```
* Objective C *
```objc
BLCaptionBar *captionBar;
-(void)viewDidLoad{
[super viewDidLoad];
self.view.userInteractionEnabled = YES;
captionBar = [[BLCaptionBar alloc] init];
//Customization
captionBar.animationTime = 0.35;
captionBar.uiDelegate = self;
[self addSubview: captionBar];
}
-(void)touchesEnded:( NSSet*)touches withEvent:(UIEvent*)event{
[captionBar slideUp];
}
-(void)someOtherMethod{
[captionBar slideDown];
}
```