nathantannar4 / inputbaraccessoryview Goto Github PK
View Code? Open in Web Editor NEWA simple and easily customizable InputAccessoryView for making powerful input bars with autocomplete and attachments
License: MIT License
A simple and easily customizable InputAccessoryView for making powerful input bars with autocomplete and attachments
License: MIT License
Hi @nathantannar4 , thanks for this project!
So, i need to customize the top separator ( i can hide the default ). But how to add an UIView at top ( UIStack top ). There is a way ? Reeded all README file and GET START too.
Thanks!
Hello,
[!] Unable to find a specification for InputBarAccessoryView
How do you set the text input to only grow to a maximum number of lines before it becomes scrollable instead.
I have seen the ability to set the maximum height of the view, however, this value is automatically set at certain places in the code.
To set the max height height to 3 lines, I currently have the following.
inputBar.shouldAutoUpdateMaxTextViewHeight = false
inputBar.maxTextViewHeight = 70
However, the maxTextViewHeight
can be set back to default by a method for if the view moves to a new window. Not sure when this might happen though.
Do you know if the above is the best way of achieving this? Or if there is a nicer way?
hi ,
i dont want to append the prefix to the autocomplete how i can accomplish that like
[img] [email protected]
not
[img] @[email protected]
getting this error No such module 'InputBarAccessoryView'
there is no pod file in root of example folder
Also, this error occur
directory not found for option '-F/Users//Library/Developer/Xcode/DerivedData//Build/Products/Debug-iphonesimulator/InputBarAccessoryView'
Hi, it seems that pasting text consisting of multiple lines causes a lot of whitespace to appear at the bottom.
Steps to repro:
Here's some text that shows the issue:
A beluga whale seen in the Thames for a second day is "swimming strongly and feeding normally", the RSPCA has said. The animal welfare charity said the whale, nicknamed Benny, had moved towards the estuary, and there were no major concerns for its welfare. It was first spotted around barges in the Thames on Tuesday near Gravesend.
Thanks!
We've found self.bar.inputTextView.becomeFirstResponder()
has to be called in or after viewDidAppear
. Placing this call earlier in the view's lifecycle has no effect. We've also tried calling becomeFirstResponder()
then this call to no avail.
We'd like the input text view to be focussed without animation immediately (akin to Messenger). How can we go about this?
Hi, i have a bug little complicate to explain
I have a textfield in the view where I use the InputBarAccessoryView
When I select this textfield, InputBarAccessoryView disappear as I expect, but when I resignFirstResponder my texfield and keyboard disappear InputBarAccessoryView is gone and never come back again... Any suggestion?
Hi, I am trying to add a video as an attachment to the input bar. I have tried both ways by adding as Data and by adding as URL. It doesn't show up the thumbnail of the video in the attachment.
Do you have any idea how to show the thumbnail if Video is attached from UIImagePickerController?
The content offset is wrong when user enter the scrollable view, the bottom item is unreadable though user scroll to the bottom. But when user tap the input text field, keyboard show, the bottom item can be seen again
I download example project and run it.
but when I switch app to Facebook message rand in Facebook messager app is active keyboard and I switch return to example app it happen
Device
** and InputAccessView happen same subview but I animation down to correct positions like pull down to hide
thank you
I try it this way:
messageInputBar.bottomStackView.axis = .vertical
messageInputBar.bottomStackView.distribution = .fillProportionally
Then I add two stackViews to the bottomStackView
messageInputBar.bottomStackView.addArrangedSubview(toolBarStackView)
messageInputBar.bottomStackView.addArrangedSubview(functionPanelStackView)
It only shows the first stackView which is toolBarStackView
What I want is to add a functionPanel below it so I can add extra content in it.
This may be an interesting question.
I have a scenario in my app where I need a view controller to have a text view in an inputAccessoryView
and a text field at the top. This works great, when both become first responder the bottom input bar is always above the keyboard as desired. But it gets interesting when I assign an inputAccessoryView
to the top text field. This causes the input bar to drop down to the bottom underneath the keyboard and only that text field's input accessory view is visible. I actually need both to be visible. It sounds strange, but the top text field's input accessory view blends right into the keyboard, so it would appear as part of the keyboard with a single input accessory view even though it's actually two stacked views. Do you see any way to do that?
Looks like it might work with the subview approach instead but this isn't really acceptable because when you drag down on the keyboard the input bar sluggishly responds.
I've reversed the stack views to provide a RTL layout with the send button on the left and input on the right. Unfortunately the placeholder's constraints means it stays on the left of this input bar regardless of the underlying text views alignment:
These are the programmatic constraints related to the UILabel acting as the placeholder, from what I can gather this is referencing the left and right anchors of the parent, aka UITextView. For this reason I'm confused to why the UILabel isn't the full width of the UITextView?
If this were the case I could easily set the text alignment property on the placeholder to achieve the RTL effect.
I'm trying to internationalize the text of the send button in InputBarAccessoryView in MessageKit. The text in French is a little longer than the text in English ("Envoyer" vs "Send") and the size of the button seems to be fixed. I tried the following code but it doesn't seem to work:
messageInputBar.sendButton.configure {
let font = UIFont.systemFont(ofSize: 15, weight: .bold)
let fontAttributes = [NSAttributedString.Key.font: font]
let title = NSLocalizedString("Send", comment: "")
let size = (title as NSString).size(withAttributes: fontAttributes)
$0.setSize(CGSize(width: size.width + 10, height: 36), animated: false)
$0.title = title
$0.titleLabel?.font = font
}
How can I change the title of the button and adapt its width automatically?
My app has a bottom UITabBarController.tabBar and I believe that the KeyboardManager doesn't handle it out of the box.
The InputBar has a red background color.
I'm using the code from the "Example" folder.
Initial state:
When opening the keyboard state, there is a white padding that I suspect coming from the UITabBar:
EDIT: I found out that trying to pass a potentiel uitabbar in @discardableResult open func bind(inputAccessoryView: UIView, usingTabBar tabBar: UITabBar? = nil) -> Self
does fix the problem as so:
let tabBarHeight = tabBar?.bounds.size.height ?? 0
callbacks[.willShow] = { [weak self] (notification) in
let keyboardHeight = notification.endFrame.height
guard
self?.isKeyboardHidden == false,
self?.constraints?.bottom?.constant == 0,
notification.isForCurrentApp else { return }
self?.animateAlongside(notification) {
self?.constraints?.bottom?.constant = -keyboardHeight + tabBarHeight
self?.inputAccessoryView?.superview?.layoutIfNeeded()
}
}
callbacks[.willChangeFrame] = { [weak self] (notification) in
let keyboardHeight = notification.endFrame.height
guard
self?.isKeyboardHidden == false,
notification.isForCurrentApp else { return }
self?.animateAlongside(notification) {
self?.constraints?.bottom?.constant = -keyboardHeight + tabBarHeight
self?.inputAccessoryView?.superview?.layoutIfNeeded()
}
}
I have downloaded the code and trying to run the example but getting error for missing framework
also getting this error No such module 'InputBarAccessoryView'
The inputAccessoryView
jumps up and down when used in a UIViewController
but not when in UITableViewController
/UICollectionViewController
You can recreate this by simply changing the Example to a UIViewController
.
I'm using ASyncDisplayKit's ASCollectionNode
instead of UIKit's collection view for performance, therefore I'm using a UIViewController
. Have I missed something or are there any known solutions for this?
is there any method like didseletect at index for autocomplete plugin so i can get the selected auto complete
When viewing the Examples on iPhone X, the UITableView bottom inset is not set correctly. There's no way to scroll to the bottom of the table. This is with release 4.2.0
InputBarAccessoryView covers tabBarController. I didn't see a setting to offset the backgroundView
. Is this possible? Much of the methods or properties like backgroundViewBottomAnchor
are private.
I tried resetting some anchors but didn't take effect.
Thanks!
In InputBarAccessoryViewController
, the function setupConstraints(to window: UIWindow?)
is modifying a constraint if UIScreen.main.nativeBounds.height == 2436
. This will not work for iPhone XS Max, iPhone XR, and iPads should they gain a home indicator in place of a home button. Can this be updated to go off something other than the screen height?
Is your app using this library? If so please make a PR with your apps name an link in the README
Sent with GitHawk
I need to develop a better way to return async results. I welcome any input.
Currently, the method of doing this is to fetch your async results, cache them in an array, and then call reloadData()
on AutocompleteManager
(assuming you are also using the AutocompleteManagerDataSource
Setting bar.inputTextView.font causes the inputTextView to grow in an undefined manner with each key stroke
Hey, great job on the library!
Is it possible to have async autocomplete results ?
I am having an issue with the inputBarAccessoryView within an app.
We need to set a draft message that was previously stored. This is done using:
inputBar.inputTextView.text = draftMessage
In our app this causes the inputBarTextView to grow past the top of the screen (going underneath status bar) and the inputBarTextView is left unscrollable so you cannot scroll within it. However, when I reproduced this in the example app, the box doesn't go beyond the maximum height, however, it is still not scrollable, so the same issue has been encountered.
If you look in the console when this happens, it is due to some conflicting constraints and so the end result in UI depends on which constraints the system decides to break.
2018-10-22 14:01:14.392632+0100 Example[63316:4832764] [LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x600003df63f0 UIView:0x7fb4e6e4a740.bottom == UILayoutGuide:0x6000027c55e0'UIViewSafeAreaLayoutGuide'.bottom - 6 (active)>",
"<NSLayoutConstraint:0x600003df63a0 V:|-(0)-[InputBarAccessoryView.InputStackView:0x7fb4e6e55c40] (active, names: '|':Example.iMessageInputBar:0x7fb4e6e47a40 )>",
"<NSLayoutConstraint:0x600003df6350 InputBarAccessoryView.InputStackView:0x7fb4e6e55c40.bottom == UIView:0x7fb4e6e4a740.top - 6 (active)>",
"<NSLayoutConstraint:0x600003dda300 '_UITemporaryLayoutHeight' Example.iMessageInputBar:0x7fb4e6e47a40.height == 0 (active)>",
"<NSLayoutConstraint:0x600003df5e00 'UIViewSafeAreaLayoutGuide-bottom' V:[UILayoutGuide:0x6000027c55e0'UIViewSafeAreaLayoutGuide']-(0)-| (active, names: '|':Example.iMessageInputBar:0x7fb4e6e47a40 )>"
)
To reproduce in example app, I set long text at the end of viewDidLoad
within CommonTableViewController
.
inputBar.inputTextView.text = """
"""
I pasted about 10 paragraphs of lorum ipsum within the string.
Multiple users have reported that long pressing to select text (paste works fine) causes the application to freeze. I am able to replicate fairly reliably with the Example project and in the context of MessageKit on devices running iOS 10.3.1
and 11.0.3
. I've attached the potentially relevant bit from the Instruments trace, but ping me in slack for the full trace file. Possibly related to the getter for intrinsicContentSize? @nathantannar4
I've spent the day in the code trying to figure out a solution for this and haven't, so I'll throw it back to the author for guidance and hopefully a solution.
In my app and the Example app:
When I type @Rick S
I get autocompletion results as expected.
When I type Hey @Rick
I get autocompletion results as expected
When I add a space and type Hey @Rick
or Hey @Rick S
, I don't get results.
A couple of things I'm seeing.
I think this code session.spaceCounter += spaceCountDiff
on lie 410 of AutocompleteManager should read session.spaceCounter = spaceCountDiff
. Otherwise, I don't see where session.spaceCounter ever decreases or resets to 0. It always grows. If it always grows, this line if let session = currentSession, session.spaceCounter <= maxSpaceCountDuringCompletion
on 164 in AutocompleteManager always fails and the session is unregistered
If I set session.spaceCount = spaceCountDiff
, the code is then allowed to pass that mentioned if statement and the .whitespaces character set is removed from the copy of delimiters. This then calls textField.find with the set of prefixes and the reduced delimiter set. Since it no longer breaks on white spaces, the wordAtCarat function returns the entire string, causing result.word.hasPrefix(prefix)
on line 20 of UITextView+Extensions to fail.
Any thoughts on how to resolve this?
Hi, how I can customize delete button for AttachmentCell?
I might be wrong, and don't want to sham on all the hard work of the library creator and contributors, but it seems that this project is missing some key functionality of the interactive keyboard + custom inputAccessoryView:
I ran the example and I noticed:
Am I missing something here?
Thanks
In some scenarios, we'd like the input bar to contain buttons only. Is there a way to collapse/hide the middle stack view?
The InputBarAccessoryView overlaps navigationbar in landscape orientation.
I was testing MessageKit on my iPhone 7 and noticed a problem with the MessageInputBar overlapping the navigationbar so that lead me to testing the InputBarAccessoryView example on my iPhone 7 as well and they both have the same problems.
Steps to reproduce the issue:
The InputBarAccessorryView is now overlapping the navigationbar:
I was also able to reproduce this issue in the iOS Simulator with the following steps:
The InputBarAccessorryView is now overlapping the navigationbar
For usablity puposes I want the keyboard to disappear before the message is acutally send on pressing a button.
So I tried to use
But they are all not working. The inputBar stays active and the keyboard doesn't hide.
Any idea?
Hi,
Great work on the library! I noticed that the typing indicator overlays the last tableviewcell rather than pushing the tableview up.
if you set
showAddAttachmentCell = false
because you want just 1 attachment
and press again the StackViewItems second attachment is added.
How can i set a maximum of 1 attachment or disable the StackViewItems wen one attachment is added?
Hello, Thanks for your Awesome library :)
I tried to install InputBarAccessoryView with pod, but some error I found
CocoaPods could not find compatible versions for pod "InputBarAccessoryView":
In Podfile:
InputBarAccessoryView (= 4.2.2)
so I do it with 4.2.1 and It works well.
Hi !
Thank you for this awesome library.
I'd like to use the Rx proxy, but it seems that this extension is not accessible (not public) so I cannot use it. I tried using inputBar.rx_delegate but this is not recognized.
Maybe this extension could also be used like other rx libraries, so renaming rx_delegate to rx only ?
Thank you :)
How can I create a press and hold button to record and send audio. I'm using MessageKit.
@nathantannar4 Using your example project... this is the output I get for shouldComplete
and shouldUnregister
Tried to access manager.currentSession
as the optional in image above. The text
parameter is empty in shouldComplete
Shouldn't text
be the autocomplete I selected?
Thanks!
I am having an issue with the inputBarAccessoryView within an app.
We need to set a draft message that was previously stored. This is done using:
inputBar.inputTextView.text = draftMessage
In our app this causes the inputBarTextView to grow past the top of the screen (going underneath status bar) and the inputBarTextView is left unscrollable so you cannot scroll within it. However, when I reproduced this in the example app, the box doesn't go beyond the maximum height, however, it is still not scrollable, so the same issue has been encountered.
If you look in the console when this happens, it is due to some conflicting constraints and so the end result in UI depends on which constraints the system decides to break.
2018-10-22 14:01:14.392632+0100 Example[63316:4832764] [LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x600003df63f0 UIView:0x7fb4e6e4a740.bottom == UILayoutGuide:0x6000027c55e0'UIViewSafeAreaLayoutGuide'.bottom - 6 (active)>",
"<NSLayoutConstraint:0x600003df63a0 V:|-(0)-[InputBarAccessoryView.InputStackView:0x7fb4e6e55c40] (active, names: '|':Example.iMessageInputBar:0x7fb4e6e47a40 )>",
"<NSLayoutConstraint:0x600003df6350 InputBarAccessoryView.InputStackView:0x7fb4e6e55c40.bottom == UIView:0x7fb4e6e4a740.top - 6 (active)>",
"<NSLayoutConstraint:0x600003dda300 '_UITemporaryLayoutHeight' Example.iMessageInputBar:0x7fb4e6e47a40.height == 0 (active)>",
"<NSLayoutConstraint:0x600003df5e00 'UIViewSafeAreaLayoutGuide-bottom' V:[UILayoutGuide:0x6000027c55e0'UIViewSafeAreaLayoutGuide']-(0)-| (active, names: '|':Example.iMessageInputBar:0x7fb4e6e47a40 )>"
)
To reproduce in example app, I set long text at the end of viewDidLoad
within CommonTableViewController
.
inputBar.inputTextView.text = """
"""
I pasted about 10 paragraphs of lorum ipsum within the string.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.