是否有可能在Lion上的许多应用程序中获得"pull-to-refresh"滚动视图?我已经能够在滚动视图的"反弹区域"中查看我的视图,并检测何时刷新.我的问题是在刷新时保持视图向上滚动,然后在完成时禁用它.
有任何想法吗?
我正在使用这个PullToRefresh插件:
https://github.com/BoxFactura/pulltorefresh.js#api
它运作良好,但我的页面上有一个带有div内联滚动的弹出窗口.问题是,当我想向上滚动(在div中)时,会触发PullToRefresh.当我的弹出窗口打开时,是否可以"删除"或暂时禁用PullToRefresh?
PullToRefresh.init({
mainElement: 'body',
onRefresh: function(){
refreshAll();
}
});
Run Code Online (Sandbox Code Playgroud)
编辑:
delete PullToRefresh;//不起作用
edit2:https: //github.com/BoxFactura/pulltorefresh.js/blob/master/dist/pulltorefresh.js
我是iOS开发人员,最近我安装了最新的iOS 6进行测试.当我遇到邮件拉动刷新动画时,我决定尝试自己实现它.我试图使用带有UIBezierPath的CAShapeLayer来创建可以向前拖动的相同椭圆形状.并且为了使向下部分向下伸展,我尝试使用添加两个控制点的曲线并应用CABasicAnimation.但不幸的是,结果并不像我预期的那样.由于拉伸的线条内部有一点椭圆形.我想椭圆动画必须与其他类做一些事情.如果有人能引导我在这里提出一些想法,我将非常感激.非常感谢
- (UIBezierPath *)createCircleForRect:(CGRect)bRect
{
UIBezierPath *circle = [UIBezierPath bezierPath];
CGFloat rectWidth = bRect.size.width;
CGFloat rectHeight = bRect.size.height;
minSize = MIN(rectWidth, rectHeight);
//center = CGPointMake(minSize/2.0f, minSize/2.0f);
CGFloat radius = minSize/2.0f - 5.0f;
startPointOffset = center.x - radius;
if(startPointOffset == 5.0f)
testVal = 0;
else
testVal += startPointOffset;
NSLog(@"startPointOffset =>> %f", startPointOffset);
NSLog(@"radius =>> %f", radius);
NSLog(@"after center =>> %f, %f", center.x, center.y);
[circle addArcWithCenter:center radius:radius startAngle:DEGREES_TO_RADIANS(0) endAngle:DEGREES_TO_RADIANS(180) clockwise:NO];
[circle moveToPoint:CGPointMake(startPointOffset, center.y)];
[circle addCurveToPoint:CGPointMake(center.x + radius, center.y) controlPoint1:CGPointMake(center.x - radius, …Run Code Online (Sandbox Code Playgroud) 我正在使用Swift进行iOS上的pull-to-refresh.
我有一个带有城市名称的数组,cityNames = ["Chicago", "New York City"]
我实现了一个pull-to-refresh来从互联网上获取温度数据.因此,每当我触发拉动刷新时,它将进入互联网并获得cityNames阵列中每个城市的温度.
这是pull-to-refresh的代码
var weatherDetail = [Weather]()
// Pull to refresh
func refreshData() {
var cityNames = [String]()
for (index, _) in weatherDetail.enumerate() {
let info = weatherDetail[index]
cityNames.append(info.cityName)
}
print(cityNames)
weatherDetail.removeAll()
for city in cityNames {
self.forwardGeocoding(city)
}
weatherCityTable.reloadData()
refreshControl.endRefreshing()
}
Run Code Online (Sandbox Code Playgroud)
在上面的代码中,weatherDetail是一个模型数组(我不知道如何用这句话,但是Weather是一个模型,其中包含城市名称,温度,太阳升起时间,高/低温度.
forwardGeocoding是一个获得地理协调的函数对于一个城市然后发送请求获取该城市的天气数据.
拉动刷新工作,我遇到的问题是,我拉的前2,3次,它没有问题.但是当我拉多次时,阵列会突然改变为cityNames = ["Chicago", "Chicago"]
感谢您的帮助,如果您需要更多信息,请告诉我.
更新:
我删除了weatherDetail.removeAll(),尝试将相同的数据附加到阵列.刷新后,打印出来"Chicago", "New York City", "Chicago", "Chicago".如果我刷新多次,它打印出像"Chicago", "New York City", "Chicago", …
我已经WKWebView在iOS中直接实现了.
var refreshControl = UIRefreshControl()
refreshControl.addTarget(self, action: Selector("refreshWebView"), forControlEvents: UIControlEvents.ValueChanged)
Run Code Online (Sandbox Code Playgroud)
这是在 viewDidLoad()
和相应的refreshWebView功能.但是当我在移动设备或模拟器上运行它时,无论我拖动多少,都没有拉动刷新动作.什么都没有被触发,几乎感觉我被困在屏幕的上限.哪里可能出错?
I want to move Recyclerview together with the Swipe Refresh Layout indicator (do not place the indicator above the Recyclerview, but Recyclerview should be appeared below of swipe refresh indicator).
我在一个SwipeRefreshLayout. 相应的 XML 如下。
<android.support.v4.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/swipe_refresh_news">
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:scrollbars="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</android.support.v4.widget.SwipeRefreshLayout>
Run Code Online (Sandbox Code Playgroud)
目前滑动看起来像这样:
android pull-to-refresh swiperefreshlayout android-recyclerview
我正在尝试将下拉刷新添加到 WKWebView。我将在此代码中的何处添加一些允许我触发下拉刷新的内容?我还没有找到任何可行的方法将它添加到我的代码中,因此您不会在下面的代码中找到我尝试完成此操作的任何尝试。我找到的大多数答案都使用 Objective-C 或我的项目不支持的语言。
import UIKit
import WebKit
class CycleViewController: UIViewController, WKNavigationDelegate, WKUIDelegate {
var webView: WKWebView!
@IBOutlet weak var containerView: UIView!
@IBOutlet weak var progressView: UIProgressView!
override func loadView() {
super.loadView()
}
override func viewDidLoad() {
super.viewDidLoad()
progressView.setProgress(0.1, animated: true)
let webConfiguration = WKWebViewConfiguration()
webConfiguration.applicationNameForUserAgent = "Version/8.0.2 Safari/600.2.5"
let customFrame = CGRect.init(origin: CGPoint.zero, size: CGSize.init(width: 0.0, height: self.containerView.frame.size.height))
webView = WKWebView(frame: customFrame, configuration: webConfiguration)
webView.uiDelegate = self
webView.navigationDelegate = self
self.containerView.addSubview(webView)
self.webView.translatesAutoresizingMaskIntoConstraints = false
self.view.addConstraint(NSLayoutConstraint(item: webView, attribute: .trailing, relatedBy: …Run Code Online (Sandbox Code Playgroud) 我无法在任何地方找到许多引用此警告的内容.我有两个视图控制器,提供拉动刷新控制.一个很好.另一个产生上面的警告.我将代码从一个复制到另一个.
代码如下(PFUser指的是Parse.com):
[super viewDidAppear:animated];
if ([PFUser currentUser]) {
NSLog(@"who's the user: %@", [PFUser currentUser]);
UIRefreshControl *refreshTable = [[UIRefreshControl alloc] init];
refreshTable.attributedTitle = [[NSAttributedString alloc] initWithString:@"One sec... refreshing"];
[refreshTable addTarget:self action:@selector(refresh:) forControlEvents:UIControlEventValueChanged];
self.refreshControl = refreshTable;
} else {
Run Code Online (Sandbox Code Playgroud)
有人遇到过这种情况么?是否有解决方法?
我们正在使用Cordova,html,css构建多平台移动应用程序.对于我们的一些屏幕,我们需要pull to refresh功能.我试过Damien的解决方案(http://damien.antipa.at/2012/10/16/ios-pull-to-refresh-in-mobile-safari-with-native-scrolling/)和iScroll for iOS,它很棒适用于iOS平台.但是没有一种方法适用于Android平台.有人可以帮我这个吗?如何为Android平台构建pull To Refresh.
我正在尝试SwipeListView使用Pull-to-Refresh实现ListView.它成功集成,但它后面的列表中添加了一个项目.列表视图不爽快.没有项目添加到列表中.
我已经实现了SwipeListView从这里,并拉来刷新来自这里.如何在列表视图中添加多个项目并在添加项目后刷新列表.
JAVA代码
package com.eample.swipelistviewexample;
import java.util.ArrayList;
import java.util.List;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.res.TypedArray;
import android.os.AsyncTask;
import android.os.Bundle;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.util.DisplayMetrics;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.LayoutInflater;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.fortysevendeg.swipelistview.BaseSwipeListViewListener;
import …Run Code Online (Sandbox Code Playgroud) pull-to-refresh ×10
ios ×5
android ×3
swift ×3
wkwebview ×2
arrays ×1
cocoa ×1
cordova ×1
ios7 ×1
javascript ×1
nsscrollview ×1
osx-lion ×1
refresh ×1
uitableview ×1
xcode5 ×1