如果数据在线更改,则更新tableview [英] update tableview if data is changed online

查看:88
本文介绍了如果数据在线更改,则更新tableview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在为已经制作了可以通过该应用下订单的应用的酒店制作一个应用.通过刷新页面,可以在Web门户上看到所有这些订单.

We are making an app for the hotel where we have already made an app where orders can be placed through app. All those orders can be seen on web portal by refreshing the page.

现在,客户要求创建一个应用程序,以便服务员可以在其iPad上看到订单.

Now client requested to create an app where waiter can see the order on his iPad.

为此,我们将在表格视图中显示所有订单清单.

For that we will be having the tableview where all list of orders will be shown.

但是,如果获得新订单,我将无法刷新表/添加数据.

However I am not getting how I will refresh the table/ add the data if new order is made.

简而言之,一旦下订单,服务员应该在同一时刻收到警报并更新表视图.

In short once order is made, at same instance waiter should get alert and table view should be updated.

注意:iPad/iPhone通过网络服务获取数据.

Note: iPad/ iPhone get the data through webservice.

这可以通过每1分钟或30秒调用一次Web服务来实现.

This can be achieved by calling webservice every 1 min or 30 seconds.

但是我不想这样做...

However I don't want to do this way...

如果添加了新内容,则网络服务将发送该数据,然后将其添加到我的表视图中. 手段Web服务将向我发送已添加新数据的侦听器

If new stuff is added, webservice will send that data and I will add that data in my tableview. Means webservice will send me listener that new data is added

如果Web服务向我发送侦听器,我需要知道如何侦听该侦听器.

I need to know how can I listen this listener if webservice send me listener.

任何对此有用的信息,将不胜感激.

Any useful info on this would be appreciated.

下面的链接帮助我实现了iOS中的TCP.

Below link helped me for TCP in iOS.

http://www.tekritisoftware.com/sites/default/files/Socket_Programing_for_IOS.pdf

推荐答案

您可以使用基于TCP的客户端-服务器方法来实现它,其中iPad是客户端.

You could implement it using a TCP-based client-server approach, where the iPad is the client.

  1. iPad客户端使用身份验证连接到服务器,因此您知道哪个服务员正在使用iPad.
  2. TCP在TCP套接字上使用双工通信,因此任何一方都可以向另一方发送消息.
  3. 如果服务器有东西要送给iPad/客户端/服务员,则只需将其发送给他们.
  4. 如果客户端希望将消息发送到服务器,例如我正在休息"或其他,则只需将其发送到服务器.
  5. 您可以在客户端和服务器之间共享的信息范围实际上是无限的.
  6. 没有6.

但是,这也需要编写服务器,因此,此解决方案不仅限于iOS开发.但是,无论如何,Web服务都需要进行类似的开发.

This requires the server to be written as well, however, so this solution is more than just iOS development. However a webservice would need similar development anyway.

这篇关于如果数据在线更改,则更新tableview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆