当前位置: 编程技术>移动开发
本页文章导读:
▪ivy模块化资料 ivy模块化文件
<ivy-module version="2.0"> <info organisation="org.apache" module="hello-ivy" /> <dependencies defaultconfmapping="*->default,sources"> <dependency org="commons-lang" name="commons-lang" rev="2.3" /> .........
▪ jetty札记 jetty笔记
package com.bierbobo;import java.io.IOException;import javax.servlet.ServletException;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import org.mortbay.j.........
▪ 优化——UIScrollView经过内容延迟加载以达到平滑滑动 优化——UIScrollView通过内容延迟加载以达到平滑滑动。
原文链接: http://blog.sina.com.cn/s/blog_6297d52d01010dqz.html
前面写了一篇《UIScrollView 平滑划动处理》,是通过延迟操作来达到平滑移动,.........
[1]ivy模块化资料
来源: 互联网 发布时间: 2014-02-18
ivy模块化文件
<ivy-module version="2.0">
<info organisation="org.apache" module="hello-ivy" />
<dependencies defaultconfmapping="*->default,sources">
<dependency org="commons-lang" name="commons-lang" rev="2.3" />
<dependency org="commons-cli" name="commons-cli" rev="1.0" />
<dependency org="log4j" name="log4j" rev="1.2.15" conf="default->master" />
<dependency org="junit" name="junit" rev="4.6" />
<dependency org="org.mortbay.jetty" name="jetty" rev="6.1.22" />
</dependencies>
<!-- configurations可以理解为对dependencies的分组。 -->
<!--
defaultconfmapping="*->default,sources" 只能下载项目依赖的库的源代码,不能下载依赖库所依赖的库的源代码
-->
<!--
<configurations>
<conf name="compile" visibility="public" />
<conf name="provided" visibility="public" />
<conf name="runtime" visibility="public" extends="compile" />
<conf name="master" visibility="public" />
<conf name="test" visibility="private" extends="runtime" />
<conf name="default" visibility="public" extends="runtime,master" />
</configurations>
-->
<!-- ivy默认使用maven2 仓库。 我们推荐你使用mvnrepository.com 来查找你需要的模块。
一旦你找到它,你将得到如何在一个mavenPOM中声明依赖的细节。
name: 必须
description: 描述
visibility:public意味着能够被其它别的module使用 , private意味着仅能module本身使用
extends: 扩展其它
transitive: 是否可传递
-->
<!--
<dependencies
defaultconfmapping="compile->compile(*),master(*);runtime->master(*),compile(*),runtime(*)">
<dependency org="log4j" name="log4j" rev="1.2.11" conf="compile;runtime" />
<dependency org="hsqldb" name="hsqldb" rev="1.8.0.7"
conf="compile;runtime" />
<dependency org="org.springframework" name="spring-orm"
rev="3.0.4.RELEASE" conf="compile;runtime" />
<dependency org="org.springframework" name="spring-aop"
rev="3.0.4.RELEASE" conf="compile;runtime" />
<dependency org="org.springframework" name="spring-webmvc"
rev="3.0.4.RELEASE" conf="compile;runtime" />
<dependency org="org.springframework" name="spring-jdbc"
rev="3.0.4.RELEASE" conf="compile;runtime" />
<dependency org="org.hibernate" name="hibernate-core" rev="3.3.2.GA"
conf="compile;runtime" />
<dependency org="org.hibernate" name="hibernate-annotations"
rev="3.4.0.GA" conf="compile;runtime" />
<dependency org="org.hibernate" name="hibernate-entitymanager"
rev="3.4.0.GA" conf="compile;runtime" />
<dependency org="org.hibernate" name="ejb3-persistence"
rev="3.3.2.Beta1" conf="compile;runtime" />
<dependency org="org.apache.ibatis" name="ibatis-sqlmap"
rev="2.3.4.726" conf="compile;runtime" />
<dependency org="org.freemarker" name="freemarker" rev="2.3.9"
conf="compile;runtime" />
<dependency org="org.codehaus.jackson" name="jackson-core-asl"
rev="1.7.1" conf="compile;runtime" />
<dependency org="org.codehaus.jackson" name="jackson-mapper-asl"
rev="1.7.1" conf="compile;runtime" />
<dependency org="cglib" name="cglib" rev="2.2" conf="runtime" />
<dependency org="cglib" name="cglib-nodep" rev="2.2" conf="runtime" />
<dependency org="javassist" name="javassist" rev="3.8.0.GA"
conf="runtime" />
<dependency org="commons-dbcp" name="commons-dbcp" rev="1.4"
conf="runtime" />
<dependency org="org.slf4j" name="slf4j-jdk14" rev="1.5.0"
conf="runtime" />
<dependency org="javax.servlet" name="jstl" rev="1.1.2"
conf="runtime" />
<dependency org="taglibs" name="standard" rev="1.1.2" conf="runtime" />
<dependency org="javax.servlet" name="servlet-api" rev="2.5"
conf="provided->compile(*),master(*)" />
<dependency org="javax.servlet" name="jsp-api" rev="2.0"
conf="provided->compile(*),master(*)" />
<dependency org="junit" name="junit" rev="4.8.2" conf="test->default" />
<dependency org="org.mockito" name="mockito-all" rev="1.8.4"
conf="test->default" />
<dependency org="org.springframework" name="spring-test"
rev="3.0.4.RELEASE" conf="test->default" />
</dependencies>
-->
</ivy-module>
<ivy-module version="2.0">
<info organisation="org.apache" module="hello-ivy" />
<dependencies defaultconfmapping="*->default,sources">
<dependency org="commons-lang" name="commons-lang" rev="2.3" />
<dependency org="commons-cli" name="commons-cli" rev="1.0" />
<dependency org="log4j" name="log4j" rev="1.2.15" conf="default->master" />
<dependency org="junit" name="junit" rev="4.6" />
<dependency org="org.mortbay.jetty" name="jetty" rev="6.1.22" />
</dependencies>
<!-- configurations可以理解为对dependencies的分组。 -->
<!--
defaultconfmapping="*->default,sources" 只能下载项目依赖的库的源代码,不能下载依赖库所依赖的库的源代码
-->
<!--
<configurations>
<conf name="compile" visibility="public" />
<conf name="provided" visibility="public" />
<conf name="runtime" visibility="public" extends="compile" />
<conf name="master" visibility="public" />
<conf name="test" visibility="private" extends="runtime" />
<conf name="default" visibility="public" extends="runtime,master" />
</configurations>
-->
<!-- ivy默认使用maven2 仓库。 我们推荐你使用mvnrepository.com 来查找你需要的模块。
一旦你找到它,你将得到如何在一个mavenPOM中声明依赖的细节。
name: 必须
description: 描述
visibility:public意味着能够被其它别的module使用 , private意味着仅能module本身使用
extends: 扩展其它
transitive: 是否可传递
-->
<!--
<dependencies
defaultconfmapping="compile->compile(*),master(*);runtime->master(*),compile(*),runtime(*)">
<dependency org="log4j" name="log4j" rev="1.2.11" conf="compile;runtime" />
<dependency org="hsqldb" name="hsqldb" rev="1.8.0.7"
conf="compile;runtime" />
<dependency org="org.springframework" name="spring-orm"
rev="3.0.4.RELEASE" conf="compile;runtime" />
<dependency org="org.springframework" name="spring-aop"
rev="3.0.4.RELEASE" conf="compile;runtime" />
<dependency org="org.springframework" name="spring-webmvc"
rev="3.0.4.RELEASE" conf="compile;runtime" />
<dependency org="org.springframework" name="spring-jdbc"
rev="3.0.4.RELEASE" conf="compile;runtime" />
<dependency org="org.hibernate" name="hibernate-core" rev="3.3.2.GA"
conf="compile;runtime" />
<dependency org="org.hibernate" name="hibernate-annotations"
rev="3.4.0.GA" conf="compile;runtime" />
<dependency org="org.hibernate" name="hibernate-entitymanager"
rev="3.4.0.GA" conf="compile;runtime" />
<dependency org="org.hibernate" name="ejb3-persistence"
rev="3.3.2.Beta1" conf="compile;runtime" />
<dependency org="org.apache.ibatis" name="ibatis-sqlmap"
rev="2.3.4.726" conf="compile;runtime" />
<dependency org="org.freemarker" name="freemarker" rev="2.3.9"
conf="compile;runtime" />
<dependency org="org.codehaus.jackson" name="jackson-core-asl"
rev="1.7.1" conf="compile;runtime" />
<dependency org="org.codehaus.jackson" name="jackson-mapper-asl"
rev="1.7.1" conf="compile;runtime" />
<dependency org="cglib" name="cglib" rev="2.2" conf="runtime" />
<dependency org="cglib" name="cglib-nodep" rev="2.2" conf="runtime" />
<dependency org="javassist" name="javassist" rev="3.8.0.GA"
conf="runtime" />
<dependency org="commons-dbcp" name="commons-dbcp" rev="1.4"
conf="runtime" />
<dependency org="org.slf4j" name="slf4j-jdk14" rev="1.5.0"
conf="runtime" />
<dependency org="javax.servlet" name="jstl" rev="1.1.2"
conf="runtime" />
<dependency org="taglibs" name="standard" rev="1.1.2" conf="runtime" />
<dependency org="javax.servlet" name="servlet-api" rev="2.5"
conf="provided->compile(*),master(*)" />
<dependency org="javax.servlet" name="jsp-api" rev="2.0"
conf="provided->compile(*),master(*)" />
<dependency org="junit" name="junit" rev="4.8.2" conf="test->default" />
<dependency org="org.mockito" name="mockito-all" rev="1.8.4"
conf="test->default" />
<dependency org="org.springframework" name="spring-test"
rev="3.0.4.RELEASE" conf="test->default" />
</dependencies>
-->
</ivy-module>
[2] jetty札记
来源: 互联网 发布时间: 2014-02-18
jetty笔记
package com.bierbobo;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.mortbay.jetty.Connector;
import org.mortbay.jetty.Handler;
import org.mortbay.jetty.HttpConnection;
import org.mortbay.jetty.Request;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.handler.AbstractHandler;
import org.mortbay.jetty.handler.ContextHandler;
import org.mortbay.jetty.handler.HandlerCollection;
import org.mortbay.jetty.nio.SelectChannelConnector;
import org.mortbay.jetty.servlet.Context;
import org.mortbay.jetty.servlet.DefaultServlet;
import org.mortbay.jetty.servlet.ServletHolder;
import org.mortbay.jetty.webapp.WebAppContext;
public class JettyTest {
/*
* 1、jar配置 lib : jetty jetty-util servlet-api
* jsp-2.1: ant core jsp jsp-api
*
* 2、 Server(服务器) Connector(连接器) Handler(处理器)
*
* 3、 web配置文件发布正常的servlet addServlet可以发布内部servlet类
*/
public static void main(String[] args) throws Exception {
// 1:定义server
Server server = new Server(8020);
// 2:把连接器集合放到server里,可以在Server定义端口来代替
// addConnect(server);
// 3:并把处理器集合放到server里
// handlerCollection(server);
//
// contextHandler(server);
//
// context(server);
webAppContext(server);
// 4:启动server
server.start();
server.join();
}
/**
* 为Server设置连接器,可以通过new Server(8020)简单的设置连接器为SocketConnector连接器
* @param server
*/
private static void addConnect(Server server) {
Connector connector = new SelectChannelConnector();
connector.setPort(8020);
server.setConnectors(new Connector[] { connector });
}
/**
* 多个处理器即处理器集合:连接器的请求都会在每个处理器中处理
* @param server
*/
private static void handlerCollection(Server server) {
HandlerCollection handlers = new HandlerCollection();
Handler hello = new HelloHandler();
handlers.setHandlers(new Handler[] { hello });
server.setHandler(handlers);
}
/**
* 上下文处理器:一般处理来自web的请求。
* 如果要想处理servlet请求的话,首先要添加defaultservlet(拦截路径为全部),其次在增加自己的servlet,如下。
*
* @param server
*/
private static void contextHandler(Server server) {
ContextHandler context = new ContextHandler();
context.setContextPath("/");
Handler handler = new HelloHandler();
context.setHandler(handler);
server.setHandler(context);
}
private static void context(Server server) {
Context context = new Context(server, "/", Context.SESSIONS);
ServletHolder holder = new ServletHolder(DefaultServlet.class);
holder.setInitParameter("dirAllowed", "true");
holder.setInitParameter("welcomeServlets", "index.html");
holder.setInitParameter("resourceBase", "jetty/web");
context.addServlet(holder, "/*");
context.addServlet(new ServletHolder(new HelloServlet("li")),"/hello");
}
/**
* web请求处理器:上下文处理器的升级,专门处理web请求,不在需要增加defaultservlet。
* @param server
*/
private static void webAppContext(Server server) {
WebAppContext webapp = new WebAppContext(server, "web", "/");
webapp.addServlet(new ServletHolder(new HelloServlet("A")), "/A");
webapp.addServlet(new ServletHolder(new HelloServlet("B")), "/B");
// webapp.setContextPath("/");
// webapp.setResourceBase("jetty/web");
// server.setHandler(webapp);
}
static class HelloHandler extends AbstractHandler {
public void handle(String target, HttpServletRequest request,
HttpServletResponse response, int dispatch) throws IOException,
ServletException {
Request base_request = (request instanceof Request) ? (Request) request
: HttpConnection.getCurrentConnection().getRequest();
base_request.setHandled(true);
response.setContentType("text/html");
response.setStatus(HttpServletResponse.SC_OK);
response.getWriter().println("<h1>Hello OneHandler</h1>");
}
}
static class HelloServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private String greeting = "Hello World";
public HelloServlet() {
}
public HelloServlet(String greeting) {
this.greeting = greeting;
}
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException,
IOException {
System.out.println("收到请求");
response.setContentType("text/html");
response.setStatus(HttpServletResponse.SC_OK);
response.getWriter().println("<h1>" + greeting + "</h1>");
response.getWriter().println(
"session=" + request.getSession(true).getId());
response.getWriter().flush();
System.out.println("请求处理完成");
}
}
}
package com.bierbobo;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.mortbay.jetty.Connector;
import org.mortbay.jetty.Handler;
import org.mortbay.jetty.HttpConnection;
import org.mortbay.jetty.Request;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.handler.AbstractHandler;
import org.mortbay.jetty.handler.ContextHandler;
import org.mortbay.jetty.handler.HandlerCollection;
import org.mortbay.jetty.nio.SelectChannelConnector;
import org.mortbay.jetty.servlet.Context;
import org.mortbay.jetty.servlet.DefaultServlet;
import org.mortbay.jetty.servlet.ServletHolder;
import org.mortbay.jetty.webapp.WebAppContext;
public class JettyTest {
/*
* 1、jar配置 lib : jetty jetty-util servlet-api
* jsp-2.1: ant core jsp jsp-api
*
* 2、 Server(服务器) Connector(连接器) Handler(处理器)
*
* 3、 web配置文件发布正常的servlet addServlet可以发布内部servlet类
*/
public static void main(String[] args) throws Exception {
// 1:定义server
Server server = new Server(8020);
// 2:把连接器集合放到server里,可以在Server定义端口来代替
// addConnect(server);
// 3:并把处理器集合放到server里
// handlerCollection(server);
//
// contextHandler(server);
//
// context(server);
webAppContext(server);
// 4:启动server
server.start();
server.join();
}
/**
* 为Server设置连接器,可以通过new Server(8020)简单的设置连接器为SocketConnector连接器
* @param server
*/
private static void addConnect(Server server) {
Connector connector = new SelectChannelConnector();
connector.setPort(8020);
server.setConnectors(new Connector[] { connector });
}
/**
* 多个处理器即处理器集合:连接器的请求都会在每个处理器中处理
* @param server
*/
private static void handlerCollection(Server server) {
HandlerCollection handlers = new HandlerCollection();
Handler hello = new HelloHandler();
handlers.setHandlers(new Handler[] { hello });
server.setHandler(handlers);
}
/**
* 上下文处理器:一般处理来自web的请求。
* 如果要想处理servlet请求的话,首先要添加defaultservlet(拦截路径为全部),其次在增加自己的servlet,如下。
*
* @param server
*/
private static void contextHandler(Server server) {
ContextHandler context = new ContextHandler();
context.setContextPath("/");
Handler handler = new HelloHandler();
context.setHandler(handler);
server.setHandler(context);
}
private static void context(Server server) {
Context context = new Context(server, "/", Context.SESSIONS);
ServletHolder holder = new ServletHolder(DefaultServlet.class);
holder.setInitParameter("dirAllowed", "true");
holder.setInitParameter("welcomeServlets", "index.html");
holder.setInitParameter("resourceBase", "jetty/web");
context.addServlet(holder, "/*");
context.addServlet(new ServletHolder(new HelloServlet("li")),"/hello");
}
/**
* web请求处理器:上下文处理器的升级,专门处理web请求,不在需要增加defaultservlet。
* @param server
*/
private static void webAppContext(Server server) {
WebAppContext webapp = new WebAppContext(server, "web", "/");
webapp.addServlet(new ServletHolder(new HelloServlet("A")), "/A");
webapp.addServlet(new ServletHolder(new HelloServlet("B")), "/B");
// webapp.setContextPath("/");
// webapp.setResourceBase("jetty/web");
// server.setHandler(webapp);
}
static class HelloHandler extends AbstractHandler {
public void handle(String target, HttpServletRequest request,
HttpServletResponse response, int dispatch) throws IOException,
ServletException {
Request base_request = (request instanceof Request) ? (Request) request
: HttpConnection.getCurrentConnection().getRequest();
base_request.setHandled(true);
response.setContentType("text/html");
response.setStatus(HttpServletResponse.SC_OK);
response.getWriter().println("<h1>Hello OneHandler</h1>");
}
}
static class HelloServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private String greeting = "Hello World";
public HelloServlet() {
}
public HelloServlet(String greeting) {
this.greeting = greeting;
}
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException,
IOException {
System.out.println("收到请求");
response.setContentType("text/html");
response.setStatus(HttpServletResponse.SC_OK);
response.getWriter().println("<h1>" + greeting + "</h1>");
response.getWriter().println(
"session=" + request.getSession(true).getId());
response.getWriter().flush();
System.out.println("请求处理完成");
}
}
}
[3] 优化——UIScrollView经过内容延迟加载以达到平滑滑动
来源: 互联网 发布时间: 2014-02-18
优化——UIScrollView通过内容延迟加载以达到平滑滑动。
_scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.width, self.view.height)];
_scrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
_scrollView.backgroundColor = [UIColor clearColor];
_scrollView.contentSize = _scrollView.frame.size;
_scrollView.pagingEnabled = YES;
_scrollView.delegate = self;
[self.view addSubview:_scrollView];
CGRect scrollviewFrame = CGRectMake(0, 0, _scrollView.width, _scrollView.height);
_currentPageView = [[ContentView alloc] initWithFrame:scrollviewFrame];
_prevPageView = [[ContentView alloc] initWithFrame:scrollviewFrame];
_nextPageView = [[ContentView alloc] initWithFrame:scrollviewFrame];
[_scrollView addSubview:_prevPageView];
[_scrollView addSubview:_nextPageView];
[_scrollView addSubview:_currentPageView];
_prevPageView.autoresizingMask = _nextPageView.autoresizingMask =
_currentPageView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
//更新操作
- (void)loadContentView:(ContentView *)contentView withPageIndex:(NSInteger)page isDelay:(BOOL)isDelay
{
//判断越界
if ((_numberOfPages <= 0))
{
return;
}
Feed *feedData = nil;
if (page >= 0 && page < _feedDatas.count)
{
feedData = [_feedDatas objectAtIndex:page];
}
if (feedData != contentView.feedData)
{
//内容不一致,则调用延迟更新
[contentView loadContentWithFeed:feedData isDelay:isDelay];
}
}
#pragma mark -
#pragma mark UIScrollView
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
NSInteger page = floor((_scrollView.contentOffset.x - _scrollView.width / 2) / _scrollView.width) + 1;
if (_currentPageIndex == page || page > _numberOfPages - 1 || page < 0)
{
return;
}
//换页操作
ContentView *tempPageView = nil;
//next page
if (_currentPageIndex + 1 == page)
{
tempPageView = _currentPageView;
_currentPageView = _nextPageView;
_nextPageView = _prevPageView;
_prevPageView = tempPageView;
[_nextPageView clearContent];
}
//prev page
else if (_currentPageIndex - 1 == page)
{
tempPageView = _currentPageView;
_currentPageView = _prevPageView;
_prevPageView = _nextPageView;
_nextPageView = tempPageView;
[_prevPageView clearContent];
}
_currentPageIndex = page;
_currentPageView.left = _scrollView.width * _currentPageIndex;
_prevPageView.right = _currentPageView.left;
_nextPageView.left = _currentPageView.right;
//即时的更新,如载入缩略图等
}
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
{
if (!decelerate)
{
[self scrollViewDidEndDecelerating:scrollView];
}
}
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
//延迟更新操作,这里是调用每个页面的延迟更新操作
//这里的更新稍显复杂,如果每个页面只是UIImageView的话,则可直接通过NSTimer延迟载入内容
[self loadContentView:_currentPageView withPageIndex:_currentPageIndex isDelay:YES];
[self loadContentView:_nextPageView withPageIndex:(_currentPageIndex + 1) isDelay:YES];
[self loadContentView:_prevPageView withPageIndex:(_currentPageIndex - 1) isDelay:YES];
}
static const NSTimeInterval kContentLoadDelay = 0.5;
- (void)loadContentBody
{
//更新ContentView的延迟内容
//.......
[_activityIndicatorView stopAnimating];
}
- (void)loadContentDelayed
{
_loadTimer = nil;
[self loadContentBody];
}
- (void)startContentLoadTimer:(NSTimeInterval)delay
{
[_activityIndicatorView startAnimating];
[_loadTimer invalidate];
_loadTimer = [NSTimer scheduledTimerWithTimeInterval:delay
target:self
selector:@selector(loadContentDelayed)
userInfo:nil
repeats:NO];
}
- (void)loadContentWithFeed:(Feed *)feed isDelay:(BOOL)isDelay
{
//content相同则退出
if (feed == self.feedData)
{
return;
}
//清空content(会同时清空feedData)后赋值
[self clearContent];
self.feedData = feed;
if (nil == self.feedData)
{
return;
}
[_activityIndicatorView startAnimating];
[self loadContentHeader];
if (isDelay)
{
//真正的延迟处理
[self startContentLoadTimer:kContentLoadDelay];
}
else
{
[self loadContentBody];
}
}
原文链接: http://blog.sina.com.cn/s/blog_6297d52d01010dqz.html
前面写了一篇《UIScrollView 平滑划动处理》,是通过延迟操作来达到平滑移动,但操作起来比较生涩,而且逻辑较复杂,现在已经弃之不用。
前文已经提到,将所有的内容页全部加入到ScrollView是最简单的方法,而且能够非常平滑划动,但如果是大数据量的时候,明显是不适用的。最近参考了Three20的TTScrollView以及TTPhotoViewController后,终于找到了一种内容页延迟加载的方法,其实iOS设备上的照片浏览就是通过延迟加载的方式实现的,当你快速划动的时候,加载的是缩略图,然后再装入原图。
同样是三页轮转ScrollView.m:
[cpp] view plaincopy
翻页过程中(scrollViewDidScroll),进行必要的即时更新,但这个更新操作必须尽量少,以免影响划动的平滑体验,如加载较小的缩略图。而在翻页后,再通过延时操作载入全部内容进行更新。这样处理后的体验就跟iOS设备上原生的照片App一样,快速划动载入的是缩略图,停顿后则延迟载入正常的图片。
[cpp] view plaincopy
而页面(ContentView )内部的延迟更新代码则为:
[cpp] view plaincopy
代码示例:http://download.csdn.net/detail/gavinming/4058379
代码非常简单,很容易理解,如有更好的方法或者意见,欢迎指点。
最新技术文章: