正如我的问题已经说过的那样:我目前正在Xamarin.iOS中实现Xamarin.iOS组件,目前一切都很好,但是由于某种原因,我无法找到此链接中描述的heightForCellTopLabelAtIndexPath方法。所有其他方法对我都是可见的,甚至返回顶部单元格标签的属性化文本的方法也是可见的。
谢谢你的帮助!
发布于 2017-02-15 18:15:39
最后,我使用了GetCellTopLabelAttributedText并对其进行了修改,以适应我的用例。换句话说,我集中对齐了文本,删除了contentInset并更改了字体。我放弃了寻找丢失的方法
发布于 2016-12-13 18:12:37
哇,我甚至不知道你可以在Xamarin应用程序中使用这个库,但我在Xamarin中什么也不做,但这太酷了。好吧根据你的问题。我也无法看到该方法,因此,也许文档已经关闭,但是可以使用:
override func collectionView(_ collectionView: JSQMessagesCollectionView!, layout collectionViewLayout: JSQMessagesCollectionViewFlowLayout!, heightForMessageBubbleTopLabelAt indexPath: IndexPath!) -> CGFloat {
return firstMessageInSet(indexOfMessage: indexPath) ? 0 : kJSQMessagesCollectionViewCellLabelHeightDefault
} 唯一的区别是它引用的是messageBubbleTopLabel,而不是CellTopLabel。我认为这是正确的方法。
在屏幕截图中,我展示了这如何影响消息的外观。第一条消息的大小设置为kJSQMessagesCollectionViewCellLabelHeightDefault,消息融合将其设置为0

所以,如果这就是你想要达到的目标,那么这就是你的方法。如果没有,请告诉我,我会看看我们是否还能做些什么。
保持良好的工作状态。
发布于 2016-12-16 16:21:13
我想你是在找GetMessageBubbleTopLabelHeight!
对于这个库,我不知道任何面向Xamarin的文档,但我很乐意给出一个示例usage =)
我就是这样使用这个函数的:
public override nfloat GetMessageBubbleTopLabelHeight (MessagesCollectionView collectionView, MessagesCollectionViewFlowLayout collectionViewLayout, NSIndexPath indexPath)
{
Message message = Messages [indexPath.Row];
if (message.SenderId == Sender.UserId.ToString())
return 0.0f;
if (indexPath.Row - 1 >= 0) {
Message previousMessage = Messages [indexPath.Row - 1];
if (previousMessage.SenderId == message.SenderId)
return 0.0f;
}
return 20.0f;
}https://stackoverflow.com/questions/41103261
复制相似问题