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

Added didSelectRowAtIndexPath callback #8

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open

Added didSelectRowAtIndexPath callback #8

wants to merge 18 commits into from

Conversation

BinaryDennis
Copy link

Extended UIBubbleTableViewDataSource with a new callback for when bubbles are selected.

It seemed much nicer solution than having the current controller being a delegate for both UIBubbleTableViewDelegate and UITableViewDelegate (the table view got messes up when having both delegates).

@AlexBarinov
Copy link
Owner

Hi Dennis

Unfortunately I've got example app crashing while running the code and tapping on a message. It looks like now it is mandatory to have the didSelectRowAtIndexPath: function, which I believe should be optional (this is really not required to display the messages). In this case the code should also check if the selector exists (this is the cause of the crash).

I understand you want to add it but let's put this on hold, cause now I have feeling that putting action function into data source is wrong. There are two ways out: 1. Refactor the data source to anything else (let's say UIBubbleTableDelegate?) or 2. Create yet another protocol UIBubbleTableViewDelegate which is pretty same as UIBubbleTableDelegate.

Second point above makes no sense to me as long as it's just redefinition, and does not solve conflicts of UIBubbleTableViewDelegate and UITableViewDelegate as they both have same method: didSelectRowAtIndexPath

So now I'm inclined to think of renaming UIBubbleTableViewDataSource to anything else and extending it.

Thank you

@BinaryDennis
Copy link
Author

ok, thanks for the reply.
Moreover.....however u implement the callback, the receiving controller will have problem determining wether the [NSBubbleData view] is of type UIImageView or not. It seems like UIBubbleTable will sort the list of NSBubbles internally based on timestamp, which then prevents the receiving controller to keep an internal data array (indexes will not match).

I also tried setting tag for the views I add with [NSBubbleData dataWithView:attachmentImageView...] but it seems the tag is not preserved when the controller gets the callback?!

Possible solutions would be to add a custom field to NSBubbleData which the controller can set and then read when the callback is called.

Do you understand what I mean? What do you think would be a good solution?

@AlexBarinov
Copy link
Owner

Hi Dennis.

Alright, now I see what you mean. That's true, that inside of UIBubbleTableView data is sorted in it's own way and one can not know for sure what was pressed. Thank you for pointing this out.

Ok, this needs to be fixed then.

Returning index in the callback, however, I think does not make much sense as long as you don't know that's there with this index. There are two possible solutions in my head right now:

  1. Return NSBubbleData instead of index into callback.
  2. Add block into NSBubbleData to invoke it when bubble is pressed.

Any other ideas?

@BinaryDennis
Copy link
Author

Ive currently implemented solution 1 in my private branch, which I find easier to work with. Im also testing out other fixes so unfortunately my fork in not in state of pulling.

@rogerpn
Copy link

rogerpn commented Apr 10, 2013

How do I get a response from BubbleTypeSomeoneElse and flow it into the UIBubbleTable.

I Poll an API that we built to see if there are any new messages for me, so How to I put the new messages that were sent to me, and display them in the UIBubble Table as Bubble TypeSomeoneElse

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

Successfully merging this pull request may close these issues.

3 participants