我已经阅读了很多关于UITableViews的主题没有在iPhone上刷新,但找不到符合我情况的任何内容,所以我正在寻求帮助.
在我的类中,它扩展了UIViewController,我有一个TableView和一个'ElementList'(它是NSMutableArray的包装器)用作数据源.
一个单独的线程通过'updateList:'方法向数组添加一个新元素.发生这种情况时,我希望自动刷新tableView,但这不会发生.
通过调试我的应用程序,我可以看到'cellForRowAtIndexPath'永远不会被调用,我无法找出原因.
我试图添加一个Observer,它调用'reloadTableView'方法(它实际上被调用),但tableView没有更新.
这是我的代码:
#import <UIKit/UIKit.h>
@interface ListViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>
{
UITableView *tableView;
ElementList *elementList; // Wrapper for NSMutableArray
}
// Called by someone else, triggers the whole thing
-(void)updateList:(Element *)element;
// Added out of desperation
-(void)reloadTableView;
@end
@implementation ListViewController
-(void)loadView
{
// Create the TableView
tableView = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame] style:UITableViewStylePlain];
assert(tableView != nil);
tableView.delegate = self;
tableView.dataSource = self;
[tableView reloadData];
self.view = tableView;
// Added out of desperation
[[NSNotificationCenter defaultCenter] addObserver:self …Run Code Online (Sandbox Code Playgroud) 我可以看到,我自己和很多人在ASP.NET中这两个项目都遇到了麻烦...刷新按钮,后退按钮......(我看到很多人都去问过如何在浏览器中禁用这两个按钮..)
现在在页面中实现两个更多的布尔变量有什么问题(IsRefresh,IsPostBack)......如果这些问题可以被规避和实施,那对开发人员来说将是一笔巨大的资产......
当您回答时,如果您还可以在Web应用程序中包含您正在采取的步骤,以避免在有用的情况下重新发布(有时在数据库中).
谢谢
我在Treasure Quest工作,引导用户通过一个ruote.我在地图中显示当前位置时遇到问题,其中也显示了任务点
我扩展了ItemizedOverlay
public class QuestItemizedOverlay extends ItemizedOverlay<OverlayItem> {
private ArrayList<OverlayItem> mOverlays= new ArrayList<OverlayItem>();
public QuestItemizedOverlay(Drawable defaultmarker) {
super(boundCenterBottom(defaultmarker));
populate();
}
@Override
protected OverlayItem createItem(int i) {
return mOverlays.get(i);
}
public void addOverlay(OverlayItem overlay) {
mOverlays.add(overlay);
populate();
}
public void removeItem(int index) {
mOverlays.remove(index);
populate();
}
@Override
public int size() {
return mOverlays.size();
}
}
Run Code Online (Sandbox Code Playgroud)
当我的位置改变时,我得到了听众:
private final LocationListener locationlistener= new LocationListener() {
public void onLocationChanged(Location location) {
Log.i("LOCATION_UPDATED","");
updateWithNewLocation(location);
mapview.invalidate();
}
public void onProviderDisabled(String provider) {
}
public void …Run Code Online (Sandbox Code Playgroud) 问题是:Tkinter中的时钟指针闪烁,因为我使用w.delete,但如果我不使用它,那么时钟指针复制..请帮忙.
import Tkinter as tk; import time
from math import cos,sin,pi
import sys
root=tk.Tk(); root.title("Clock")
w = tk.Canvas(root, width=320, height=320, bg="#456", relief= "sunken", border=10)
w.pack()
size=300
def funA():
s=time.localtime()[5]
m=time.localtime()[4]
h=time.localtime()[3]
w.update()
degrees = 6*s
angle = degrees*pi*2/360
ox = 165
oy = 165
x = ox + size*sin(angle)*0.45
y = oy - size*cos(angle)*0.45
t = w.create_line(ox,oy,x,y, fill = "#ffc")
degrees1 = 6*m
angle1 = degrees1*pi*2/360
ox1 = 165
oy1 = 165
x1 = ox1 + size*sin(angle1)*0.4
y1 …Run Code Online (Sandbox Code Playgroud) 我正在尝试刷新页面,但是想要使用缓存并且无法弄清楚如何执行此操作.有两种情况:
如果我点击URL栏并点击回车(或从其他地方访问该页面),它会从缓存中重新加载页面/图像.大!
如果我点击刷新按钮或使用Javascript刷新页面,它会再次抓取所有图像并永远占用.不是很好!
我试过:top.location.reload(false);和top.location.reload(true);(我从一个iFrame发送此),并没有使用缓存.我正在避免使用location它,因此它不会在浏览器历史记录中结束两次.
问题:如何使用缓存图像重新加载页面?是否有不同的javascript函数或这是mod_expires问题?
在此先感谢您的帮助!
编辑:(来自chrome的信息:开发人员工具)
编辑2 :(来自图像的标题,safari:开发人员工具)
Javascript:top.location.reload(false); (没有缓存!)
Status Code:304 Not Modified
Request Headers
Cache-Control:max-age=0
If-Modified-Since:Tue, 28 Jun 2011 07:13:17 GMT
If-None-Match:"104684ae-a7d-66e41d40"
Referer:http://getdirectus.com/dev/media.php
User-Agent:Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; en-us) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1
Response Headers
Cache-Control:max-age=157680000
Connection:Keep-Alive
Date:Tue, 28 Jun 2011 16:56:50 GMT
Etag:"104684ae-a7d-66e41d40"
Expires:Sun, 26 Jun 2016 16:56:50 GMT
Keep-Alive:timeout=5, max=94
Server:Apache/2.0.54
Run Code Online (Sandbox Code Playgroud)
导航到页面:(使用缓存)
Status Code:200 OK
Response …Run Code Online (Sandbox Code Playgroud) 我创建了一个使用Web服务提供信息的android应用程序,然后当应用程序启动时,我将数据放入sqlite中,并从数据库管理所有内容.应用程序启动后,数据填充tablelayout.
现在我想每20秒刷新一次内容(因为来自webservice的信息可能会改变).
我怎样才能做到这一点?我使用了onResume方法,但是每次你回到tablelayout时我都不想刷新内容.
所以我想要做的是每20秒执行一次oncreate方法(连接web服务,填充我的tablelayout并显示它).我读了关于计时器或处理程序但我不知道怎么能这样做.
现在我有问题!
我从Web服务获取数据并在我的doInBackground中的数据库中插入数据..没关系.现在,我在onPostExecute方法中创建所有textview,tablerow等,但我有2个问题.第一,
UsuariosSQLiteHelper usdbh =
new UsuariosSQLiteHelper(this, "DBIncidentes", null, 1);
我在doInBackground方法中有一个上下文问题
在onPostExecute方法中,我对所有"this"都有同样的问题,比如 TableRow rowTitulo = new TableRow(this);
我知道这是一个上下文错误,我基本上知道上下文是如何工作的,但我不知道如何解决这个上下文问题.我认为初始化异步构造函数中的上下文可能有帮助,我替换在onpost ..请帮忙!
我正在编写一个脚本,它将从Twitter API"获取"最新的推文,然后使用JQuery在我的页面上将它们显示为HTML.
我是JQuery的新手,所以如果有人能指出我在JQuery网站上必要功能的方向,我将非常感激.
我目前已经构建了以下脚本:
<!-- Use the Google jQuery CDN for lib support -->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<!-- Setup and fetch the JSON data -->
<script type="text/javascript">
$(document).ready(function(){
var url='http://search.twitter.com/search.json?callback=?&q=@req';
$.getJSON(url,function(json){
<!-- Iterate the file -->
$.each(json.results,function(i,tweet){
$("#results").append('<p><img src="'+tweet.profile_image_url+'" widt="48" height="48" />'+tweet.text+'</p>');
$("#results").slideDown("slow");
});
});
});
</script>
<!-- Output the file into the DIV -->
<div id="results"></div>
Run Code Online (Sandbox Code Playgroud)
该脚本工作正常,但我现在想要结合某种形式的内容自动刷新.即每x分钟"重新获取"一次.
根据我的理解,我需要用.html替换.append,以便在重新加载之前从页面中删除内容,但是有没有人对实际获取内容的最佳方式有任何建议?我发现可能有文章表达了对浏览器内存泄漏的担忧等,并且不想走错路.
我期待你的回复,再次感谢.
我是C#的新手,我有一个小项目.我被困在某个地方.我在这里解释了(带有示例源代码):
我有一个表单应用程序.我要求用户从2个按钮中选择一个选项.有2个按钮(是和否).我的代码是这样的:
public partial class Form1 : Form
{
public int choice=0;
public Form1()
{
if(choice == 0)
{
label.Text = "Please push one of these buttons :";
// And there are buttons below this label
}
else if(choice == 1)
{
label.Text = "You just pushed YES button";
}
else if(choice == 2)
{
label.Text = "You just pushed NO button";
}
}
private void buttonYes_Click(object sender, EventArgs e)
{
choice = 1;
/*
I have to …Run Code Online (Sandbox Code Playgroud) 以前我一直在使用chrome Auto Refresh插件.但是,现在我的代码有多个ChromeDriver实例打开和关闭,我无法使用自动刷新.此外,在新计算机上安装Auto Refresh非常麻烦.
有没有办法刷新驱动程序(如果驱动程序没有变化,模拟F5说每15秒仍然不动)与Selenium类似于谷歌自动刷新?
我编写了代码来获取JSON文件并对其进行处理.但该文件每5分钟更新一次.所以我希望我的代码能够在不引起刷新的情况下获取新数据.
这是我如何获取JSON文件.
$.getJSON("new_json_file.json", function (data) {
$.each(data, function (i, item) {
//Here I am working on the data
});
});
Run Code Online (Sandbox Code Playgroud)
有人可以帮忙吗?
refresh ×10
android ×2
jquery ×2
json ×2
ajax ×1
asp.net ×1
auto-update ×1
c# ×1
caching ×1
iphone ×1
javascript ×1
selenium ×1
timer ×1
tk-toolkit ×1
tkinter ×1
twitter ×1
uitableview ×1
web-services ×1
winforms ×1