首页 \ 问答 \ 阻止单元格被拖出UITableView边界(Stop cell from being dragged out of UITableView bounds)

阻止单元格被拖出UITableView边界(Stop cell from being dragged out of UITableView bounds)

我有一个UIVIew ,我在其上加载了UITableView作为子视图。 tableView正好是它所有行(其中4行)的高度总和,大约是主视图高度的一半。

问题是,当我拖动一行来移动它时,我能够拖动超出表格的边界,这会切断我的单元格的视图(我只能看到仍然在表格边界的部分)。 是否有一个属性我可以更改以阻止单元格从表格的边界拖出?


I have a UIVIew on which I loaded a UITableView 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
更新时间:2023-05-07 16:05

最满意答案

BasicQos = 10表示客户端一次只获取10条消息,但是当您使用它时,您将始终看到一条消息。 请阅读: https//www.rabbitmq.com/consumer-prefetch.html

AMQP指定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.html

AMQP 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: 使用主题交换。 在向您的交易所发布消息时使用即时交付标志。 如果消息被拒绝:创建队列,为特定路由密钥绑定它并在队列上启动订阅者,重新发布被拒绝的消息。 使用持久队列。 由于队列创建是幂等的 ...
  • 由于没有答复,我想我做得很好;) 无论如何,在与其他利益相关者讨论要求后,决定现在可以放弃LIFO要求。 当涉及到它时,我们可以担心。 我们可能最终采用的解决方案是让工作人员打开第二个队列,让主人可以使用该队列让工作人员知道要忽略哪些工作,并提供额外的控制/监视信息(无论如何我们都需要这些信息)。 实现AMQP 1.0规范的RabbitMQ也可能对此有所帮助。 所以我会把这个问题标记为现在的答案。 其他人仍然可以自由添加或改进。 Since there is no reply I guess I did m ...
  • 您可以使用自己的循环一次使用一条消息,假设您有一个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(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'应该是 ...
  • 听起来非常适合主题交流 。 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) ...
  • 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 ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。