阻止单元格被拖出UITableView边界(Stop cell from being dragged out of UITableView bounds)
我有一个
UIVIew
,我在其上加载了UITableView
作为子视图。 tableView正好是它所有行(其中4行)的高度总和,大约是主视图高度的一半。问题是,当我拖动一行来移动它时,我能够拖动超出表格的边界,这会切断我的单元格的视图(我只能看到仍然在表格边界的部分)。 是否有一个属性我可以更改以阻止单元格从表格的边界拖出?
I have a
UIVIew
on which I loaded aUITableView
as subview. The tableView is exactly the height of all it's rows(4 of them) heights sumised, about half the height of the main view.The problem is that when I drag a row to move it I am able to drag beyond the bounds of the table and this cuts my cell's view (I am only able to see the part that is still in the table's bounds). Is there a property I can change to stop the cell from being dragable out of the table's bounds?
原文:https://stackoverflow.com/questions/17944320
最满意答案
BasicQos = 10
表示客户端一次只获取10条消息,但是当您使用它时,您将始终看到一条消息。 请阅读: https : //www.rabbitmq.com/consumer-prefetch.htmlAMQP指定basic.qos方法,允许您在使用时限制通道(或连接)上未确认的消息数(也称为“预取计数”)。
对于您的范围,您必须下载消息,将其放在临时列表中,然后插入到数据库中。
然后你可以使用:
channel.BasicAck(deliveryTag: ea.DeliveryTag, multiple: true);
void basicAck()
参数:deliveryTag - 收到的AMQP.Basic.GetOk或AMQP.Basic.Deliver中的标记
multiple - 如果所有消息都包含所提供的传递标记,则为true; false仅确认提供的交付标记。
例
final List<String> myMessagges = new ArrayList<String>(); channel.basicConsume("my_queue", false, new DefaultConsumer(channel) { @Override public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException { myMessagges.add(new String(body)); System.out.println("Received..."); if (myMessagges.size() >= 10) { System.out.println("insert into DB..."); channel.basicAck(envelope.getDeliveryTag(), true); myMessagges.clear(); } } });
BasicQos = 10
means that the client fetch only 10 messages at time, but when you consume it you will see always one message a time. Read here: https://www.rabbitmq.com/consumer-prefetch.htmlAMQP specifies the basic.qos method to allow you to limit the number of unacknowledged messages on a channel (or connection) when consuming (aka "prefetch count").
for your scope you have to download the messages, put it inside a temporary list and then insert into the DB.
an then you can use:
channel.BasicAck(deliveryTag: ea.DeliveryTag, multiple: true);
void basicAck()
Parameters: deliveryTag - the tag from the received AMQP.Basic.GetOk or AMQP.Basic.Deliver
multiple - true to acknowledge all messages up to and including the supplied delivery tag; false to acknowledge just the supplied delivery tag.
Example
final List<String> myMessagges = new ArrayList<String>(); channel.basicConsume("my_queue", false, new DefaultConsumer(channel) { @Override public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException { myMessagges.add(new String(body)); System.out.println("Received..."); if (myMessagges.size() >= 10) { System.out.println("insert into DB..."); channel.basicAck(envelope.getDeliveryTag(), true); myMessagges.clear(); } } });
相关问答
更多-
如果有动态订阅者是一种选择,我想建议两种可能的解决方案: 解决方案1: 使用主题交换。 在向您的交易所发布消息时使用强制传递标志。 如果消息被拒绝:创建队列,为特定路由密钥绑定它并在队列上启动订阅者,重新发布被拒绝的消息。 使用自动删除队列,这样当用户停止时,他们的队列将消失,整个自动创建过程可以重新启动。 解决方案2: 使用主题交换。 在向您的交易所发布消息时使用即时交付标志。 如果消息被拒绝:创建队列,为特定路由密钥绑定它并在队列上启动订阅者,重新发布被拒绝的消息。 使用持久队列。 由于队列创建是幂等的 ...
-
RabbitMQ重新排序消息(RabbitMQ reordering messages)[2021-12-10]
由于没有答复,我想我做得很好;) 无论如何,在与其他利益相关者讨论要求后,决定现在可以放弃LIFO要求。 当涉及到它时,我们可以担心。 我们可能最终采用的解决方案是让工作人员打开第二个队列,让主人可以使用该队列让工作人员知道要忽略哪些工作,并提供额外的控制/监视信息(无论如何我们都需要这些信息)。 实现AMQP 1.0规范的RabbitMQ也可能对此有所帮助。 所以我会把这个问题标记为现在的答案。 其他人仍然可以自由添加或改进。 Since there is no reply I guess I did m ... -
如何通过pika在有限的时间内使用RabbitMQ消息?(How to consume RabbitMQ messages via pika for some limited time?)[2022-07-18]
您可以使用自己的循环一次使用一条消息,假设您有一个channel和queue设置。 以下将检查队列是否为空,如果不是,则从中弹出一条消息。 queue_state = channel.queue_declare(queue, durable=True, passive=True) queue_empty = queue_state.method.message_count == 0 声明一个已经存在的队列,并设置被动标志允许你查询它的状态。 接下来我们处理一条消息: if not queue_empty: ... -
RabbitMQ(或Spring云流)可以独占消息吗?(Can RabbitMQ (or spring cloud stream) consume messages exclusively?)[2023-02-27]
RabbitMQ(AMQP)不支持; 每个消费者都会收到prefetch消息。 它确实支持独占消费者,但这意味着consumer1将获得所有消息,而consumer2只会在consumer1消亡时获取消息。 但是,Spring Cloud Stream当前不提供用于设置该选项的属性。 RabbitMQ (AMQP) doesn't support that; each consumer gets prefetch messages. It does support exclusive consumers, ... -
“并且每次订阅者启动时他都会收到所有消息,如果我继续发送相同的消息,我的消费者将获得” 正如项目自述文件中所述 “最后一次价值交换就像直接交换” 所以这是预期的行为。 与直接交换的唯一区别在于,lvc交换机跟踪每个路由密钥的最后消息,因此当新队列与具有特定绑定密钥的交换机绑定时,最后一条消息以等于路由密钥的方式发布到交换机绑定密钥(存储在缓存中)被发送到新添加的队列。 要理解,您可以更改生产者代码,以便在第一个消费者与您的交易所绑定时只发送一条消息。 然后使用相同的绑定密钥将第二个使用者绑定到您的交换机,即 ...
-
从发布者/发件人向主队列发布消息时,向邮件添加当前时间戳值。 例如,'published_on'=> 1476424186。 在消费者方面,首先检查当前时间戳和published_on的时差。 如果发现差异小于5分钟,则将您的消息发送到另一个队列(DLX队列)并设置过期时间。(使用amqp消息的'expiration'属性) 此到期值应为(当前时间戳 - published_on),并且应该以毫秒为单位。 消息将在精确的5分钟内在DLX队列中过期。 确保'x-dead-letter-exchange'应该是 ...
-
Rabbitmq订阅多种服务,但以循环方式使用它(Rabbitmq Subscribe to multiple services but consume it in a round robin fashion)[2023-06-13]
听起来非常适合主题交流 。 Sounds like a perfect fit for topic exchange. -
BasicQos = 10表示客户端一次只获取10条消息,但是当您使用它时,您将始终看到一条消息。 请阅读: https : //www.rabbitmq.com/consumer-prefetch.html AMQP指定basic.qos方法,允许您在使用时限制通道(或连接)上未确认的消息数(也称为“预取计数”)。 对于您的范围,您必须下载消息,将其放在临时列表中,然后插入到数据库中。 然后你可以使用: channel.BasicAck(deliveryTag: ea.DeliveryTag, multi ...
-
这是个有趣的问题。 我自己不是EasyNetQ专家,也许其他人会来并给你一个更好的答案。 然而,我已经熟悉EasyNetQ代码库大约一年了,而且在我看来,了解在连接消费者时(以及当调用消费者时)发生的事情是很棘手的。 我首先要指出的是,只需更改方法的签名,就不能保证消息按顺序处理。 查看建议界面的此实现示例: IDisposable Consume(IQueue queue, Action
onMessage) ... -
RabbitMQ预取(RabbitMQ Prefetch)[2022-09-25]
api在幕后处理这个问题,所以不用担心。 关于哪个消息到达哪里,RMQ将通过使用循环来传递,即如果你有队列: 1 2 3 4 5 6和consumer1和consumer2 。 consumer1 will have 1 3 5 consumer2 will have 2 4 6 如果连接死于您的任何消费者,预取的消息将使用相同的传递方法重新传递给活跃的消费者。 这应该是有趣的阅读和一个很好的起点,以更准确地说明发生了什么: 我确定你读过的第2号教程 可靠性 The api handles this be ...