<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>评论：作者</title>
	<atom:link href="http://c.gzl.name/about/feed" rel="self" type="application/rss+xml" />
	<link>http://c.gzl.name</link>
	<description>IPhone, Cocoa, PHP, Javascript, JQuery, Actionscript, etc...</description>
	<lastBuildDate>Wed, 07 Dec 2011 20:58:30 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>来自：Cynric</title>
		<link>http://c.gzl.name/about/comment-page-1#comment-1459</link>
		<dc:creator>Cynric</dc:creator>
		<pubDate>Mon, 23 Aug 2010 11:20:28 +0000</pubDate>
		<guid isPermaLink="false">http://c.gzl.name/?page_id=2#comment-1459</guid>
		<description>请教一个问题，最近在做一个项目。一个类似电子杂志的项目。因为客户需求，如果用pdf做的话怕影响效率。就把pdf转成分辨率较高的图片，一次读取三个，这样画面上最多就加载三个图片。我使用了UIScrollView的嵌套，一个负责缩放，一个负责翻页。现在的问题是，当负责缩放的View的zoomScale放大的时候，划过屏幕相应的第一个事件是翻页，而不是移动当前的画面。请教如何解决。附上代码：//
//  MagazineTestViewController.m
//  MagazineTest
//
//  Created by Cynric on 10-8-20.
//  Copyright __MyCompanyName__ 2010. All rights reserved.
//

#import &quot;MagazineTestViewController.h&quot;
#import &quot;Manager.h&quot;


@implementation MagazineTestViewController
@synthesize scrollView;

/*
// The designated initializer. Override to perform setup that is required before the view is loaded.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
        // Custom initialization
    }
    return self;
}
*/

/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
}
*/


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
	
//	scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0,0,768,1024)];
	
	self.view.backgroundColor = [UIColor viewFlipsideBackgroundColor];
	[scrollView setCanCancelContentTouches:NO];
	scrollView.indicatorStyle = UIScrollViewIndicatorStyleWhite;
	scrollView.clipsToBounds = YES;		
	scrollView.scrollEnabled = YES;
	scrollView.pagingEnabled = YES;
	
		//[self.view addSubview:scrollView];
	
	NSUInteger i;
	
	CGFloat curXLoc = 0;
	
	for (i = 1; i &lt;= 5; i++)
	{
		// setup each frame to a default height and width, it will be properly placed when we call &quot;updateScrollList&quot;
		CGRect frame = CGRectMake(curXLoc, 0, 768, 1000);
	//	frame.origin = CGPointMake(curXLoc, 0);
		curXLoc += (768);
		//imageView.tag = i;	// tag our images for later use when we place them in serial fashion
		
		UIScrollView *imgScroller = [[UIScrollView alloc] initWithFrame:frame];
		
		//UIImage *image = [Manager getImageNoCache:[NSString stringWithFormat:@&quot;002%d.png&quot;, i]];

		
		CGRect rectForImage = CGRectMake(0, 0, 768, 1000);
		UIImageView *imageView = [[UIImageView alloc] initWithFrame:rectForImage];
		imageView.tag = i;
	//	[imgScroller]
		
	//	imgScroller.scrollEnabled = YES;
	//	imgScroller.pagingEnabled = YES;
		
		imgScroller.contentSize = CGSizeMake(768, 1000);// rectForImage.size;
		
		[scrollView addSubview:imgScroller];
		
		imgScroller.minimumZoomScale = imgScroller.frame.size.width/imageView.frame.size.width;
		
		imgScroller.maximumZoomScale = 2.0;
		
		
		imgScroller.delegate = self;
		imgScroller.tag = 500+i;
	
		imgScroller.zoomScale = imgScroller.minimumZoomScale;
		NSLog(@&quot;size width: %f&quot;,imgScroller.contentSize.width);
		[imgScroller addSubview:imageView];
				
		[imgScroller release];
		[imageView release];
	}
	
	scrollView.delegate = self;
	scrollView.tag = 10000;
	
	UIScrollView *currentScroller = (UIScrollView *)[scrollView viewWithTag:500+1];
	
	
	UIImageView *currentView = (UIImageView *)[currentScroller viewWithTag:1];
    currentView.image = [Manager getImageNoCache:[NSString stringWithFormat:@&quot;002%d.png&quot;, 1]];
	
	[scrollView setContentSize:CGSizeMake(5 * 768, 1000)];
	
}



// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return YES;
}

- (void)didReceiveMemoryWarning {
	// Releases the view if it doesn&#039;t have a superview.
    [super didReceiveMemoryWarning];
	
	// Release any cached data, images, etc that aren&#039;t in use.
}

- (void)viewDidUnload {
	// Release any retained subviews of the main view.
	// e.g. self.myOutlet = nil;
}

#pragma mark delegate method

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)ascrollView
{
	if(ascrollView.tag !=10000)
	{
		return ascrollView;
	}
	else {
		return nil;
	}

}

- (void)scrollViewWillBeginDragging:(UIScrollView *)ascrollView
{
	if (ascrollView.tag != 10000) {
//		return ;
	}
	
	NSInteger currentPage = (NSInteger)(ascrollView.contentOffset.x/768)+1;
    NSLog(@&quot;Begin : currentPage = %d&quot;,currentPage);
    if (currentPage = 6) {
		UIScrollView *lastScroller = (UIScrollView *)[ascrollView viewWithTag:500+4];
        UIImageView *lastImageView = (UIImageView *)[lastScroller viewWithTag:4];
        lastImageView.image = [Manager getImageNoCache:[NSString stringWithFormat:@&quot;002%d.png&quot;, 4]];
        
    } else {
		UIScrollView *lastScroller = (UIScrollView *)[ascrollView viewWithTag:500+currentPage-1];
        UIImageView *lastImageView = (UIImageView *)[lastScroller viewWithTag:currentPage-1];
        NSString *tmpStr = [NSString stringWithFormat:@&quot;002%d.png&quot;,currentPage-1];
       // lastImageView.image = [Manager getImageNoCache:[NSString stringWithFormat:@&quot;%@&quot;, tmpStr]];
		lastImageView.image = [UIImage imageNamed:tmpStr];
		
		
        UIScrollView *nextScroller = (UIScrollView *)[ascrollView viewWithTag:500+currentPage+1];
		UIImageView *nextImageView = (UIImageView *)[nextScroller viewWithTag:currentPage+1];
        NSString *tmpStr1 = [NSString stringWithFormat:@&quot;002%d.png&quot;,currentPage+1];
       // nextImageView.image = [Manager getImageNoCache:[NSString stringWithFormat:@&quot;%@&quot;, tmpStr1]];
		nextImageView.image = [UIImage imageNamed:tmpStr1];
        
    }
}


- (void)scrollViewDidEndDecelerating:(UIScrollView *)ascrollView
{
    NSInteger currentPage = (NSInteger)(ascrollView.contentOffset.x/768)+1;
    NSLog(@&quot;End : currentPage = %d&quot;,currentPage);
    for (NSInteger i = 1; i &lt;= 5; i++) {
        if (i != currentPage) {
			UIScrollView *currentScroller = (UIScrollView *)[ascrollView viewWithTag:500+i];
			
            UIImageView *otherImageView = (UIImageView *)[currentScroller viewWithTag:i];
            otherImageView.image = nil;
        }
    }
	UIScrollView *currentScrollerView = (UIScrollView *)[ascrollView viewWithTag:500+currentPage];
	
    UIImageView *currentView = (UIImageView *)[currentScrollerView viewWithTag:currentPage];
    if (currentView.image == nil) {
  //      NSString *tmpStr = [NSString stringWithFormat:@&quot;fxjyogapic%d.png&quot;,currentPage+1];
        currentView.image = [Manager getImageNoCache:[NSString stringWithFormat:@&quot;002%d.png&quot;, currentPage]];
        //currentView.image = [UIImage imageNamed:[NSString stringWithFormat:@&quot;fxjofficeExciresebg%d.png&quot;,currentPage+1]];
    }
}

- (void)scrollViewDidScrollToTop:(UIScrollView *)ascrollView
{
	NSLog(@&quot;Scrolling tag:%d&quot;,ascrollView.tag);
}

- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale
{
	
}


- (void)dealloc {
    [super dealloc];
}

@end</description>
		<content:encoded><![CDATA[<p>请教一个问题，最近在做一个项目。一个类似电子杂志的项目。因为客户需求，如果用pdf做的话怕影响效率。就把pdf转成分辨率较高的图片，一次读取三个，这样画面上最多就加载三个图片。我使用了UIScrollView的嵌套，一个负责缩放，一个负责翻页。现在的问题是，当负责缩放的View的zoomScale放大的时候，划过屏幕相应的第一个事件是翻页，而不是移动当前的画面。请教如何解决。附上代码：//<br />
//  MagazineTestViewController.m<br />
//  MagazineTest<br />
//<br />
//  Created by Cynric on 10-8-20.<br />
//  Copyright __MyCompanyName__ 2010. All rights reserved.<br />
//</p>
<p>#import &#8220;MagazineTestViewController.h&#8221;<br />
#import &#8220;Manager.h&#8221;</p>
<p>@implementation MagazineTestViewController<br />
@synthesize scrollView;</p>
<p>/*<br />
// The designated initializer. Override to perform setup that is required before the view is loaded.<br />
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {<br />
    if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {<br />
        // Custom initialization<br />
    }<br />
    return self;<br />
}<br />
*/</p>
<p>/*<br />
// Implement loadView to create a view hierarchy programmatically, without using a nib.<br />
- (void)loadView {<br />
}<br />
*/</p>
<p>// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.<br />
- (void)viewDidLoad {<br />
    [super viewDidLoad];</p>
<p>//	scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0,0,768,1024)];</p>
<p>	self.view.backgroundColor = [UIColor viewFlipsideBackgroundColor];<br />
	[scrollView setCanCancelContentTouches:NO];<br />
	scrollView.indicatorStyle = UIScrollViewIndicatorStyleWhite;<br />
	scrollView.clipsToBounds = YES;<br />
	scrollView.scrollEnabled = YES;<br />
	scrollView.pagingEnabled = YES;</p>
<p>		//[self.view addSubview:scrollView];</p>
<p>	NSUInteger i;</p>
<p>	CGFloat curXLoc = 0;</p>
<p>	for (i = 1; i &lt;= 5; i++)<br />
	{<br />
		// setup each frame to a default height and width, it will be properly placed when we call &quot;updateScrollList&quot;<br />
		CGRect frame = CGRectMake(curXLoc, 0, 768, 1000);<br />
	//	frame.origin = CGPointMake(curXLoc, 0);<br />
		curXLoc += (768);<br />
		//imageView.tag = i;	// tag our images for later use when we place them in serial fashion</p>
<p>		UIScrollView *imgScroller = [[UIScrollView alloc] initWithFrame:frame];</p>
<p>		//UIImage *image = [Manager getImageNoCache:[NSString stringWithFormat:@&quot;002%d.png&quot;, i]];</p>
<p>		CGRect rectForImage = CGRectMake(0, 0, 768, 1000);<br />
		UIImageView *imageView = [[UIImageView alloc] initWithFrame:rectForImage];<br />
		imageView.tag = i;<br />
	//	[imgScroller]</p>
<p>	//	imgScroller.scrollEnabled = YES;<br />
	//	imgScroller.pagingEnabled = YES;</p>
<p>		imgScroller.contentSize = CGSizeMake(768, 1000);// rectForImage.size;</p>
<p>		[scrollView addSubview:imgScroller];</p>
<p>		imgScroller.minimumZoomScale = imgScroller.frame.size.width/imageView.frame.size.width;</p>
<p>		imgScroller.maximumZoomScale = 2.0;</p>
<p>		imgScroller.delegate = self;<br />
		imgScroller.tag = 500+i;</p>
<p>		imgScroller.zoomScale = imgScroller.minimumZoomScale;<br />
		NSLog(@&quot;size width: %f&quot;,imgScroller.contentSize.width);<br />
		[imgScroller addSubview:imageView];</p>
<p>		[imgScroller release];<br />
		[imageView release];<br />
	}</p>
<p>	scrollView.delegate = self;<br />
	scrollView.tag = 10000;</p>
<p>	UIScrollView *currentScroller = (UIScrollView *)[scrollView viewWithTag:500+1];</p>
<p>	UIImageView *currentView = (UIImageView *)[currentScroller viewWithTag:1];<br />
    currentView.image = [Manager getImageNoCache:[NSString stringWithFormat:@&quot;002%d.png&quot;, 1]];</p>
<p>	[scrollView setContentSize:CGSizeMake(5 * 768, 1000)];</p>
<p>}</p>
<p>// Override to allow orientations other than the default portrait orientation.<br />
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {<br />
    return YES;<br />
}</p>
<p>- (void)didReceiveMemoryWarning {<br />
	// Releases the view if it doesn&#039;t have a superview.<br />
    [super didReceiveMemoryWarning];</p>
<p>	// Release any cached data, images, etc that aren&#039;t in use.<br />
}</p>
<p>- (void)viewDidUnload {<br />
	// Release any retained subviews of the main view.<br />
	// e.g. self.myOutlet = nil;<br />
}</p>
<p>#pragma mark delegate method</p>
<p>- (UIView *)viewForZoomingInScrollView:(UIScrollView *)ascrollView<br />
{<br />
	if(ascrollView.tag !=10000)<br />
	{<br />
		return ascrollView;<br />
	}<br />
	else {<br />
		return nil;<br />
	}</p>
<p>}</p>
<p>- (void)scrollViewWillBeginDragging:(UIScrollView *)ascrollView<br />
{<br />
	if (ascrollView.tag != 10000) {<br />
//		return ;<br />
	}</p>
<p>	NSInteger currentPage = (NSInteger)(ascrollView.contentOffset.x/768)+1;<br />
    NSLog(@&quot;Begin : currentPage = %d&quot;,currentPage);<br />
    if (currentPage = 6) {<br />
		UIScrollView *lastScroller = (UIScrollView *)[ascrollView viewWithTag:500+4];<br />
        UIImageView *lastImageView = (UIImageView *)[lastScroller viewWithTag:4];<br />
        lastImageView.image = [Manager getImageNoCache:[NSString stringWithFormat:@"002%d.png", 4]];</p>
<p>    } else {<br />
		UIScrollView *lastScroller = (UIScrollView *)[ascrollView viewWithTag:500+currentPage-1];<br />
        UIImageView *lastImageView = (UIImageView *)[lastScroller viewWithTag:currentPage-1];<br />
        NSString *tmpStr = [NSString stringWithFormat:@"002%d.png",currentPage-1];<br />
       // lastImageView.image = [Manager getImageNoCache:[NSString stringWithFormat:@"%@", tmpStr]];<br />
		lastImageView.image = [UIImage imageNamed:tmpStr];</p>
<p>        UIScrollView *nextScroller = (UIScrollView *)[ascrollView viewWithTag:500+currentPage+1];<br />
		UIImageView *nextImageView = (UIImageView *)[nextScroller viewWithTag:currentPage+1];<br />
        NSString *tmpStr1 = [NSString stringWithFormat:@"002%d.png",currentPage+1];<br />
       // nextImageView.image = [Manager getImageNoCache:[NSString stringWithFormat:@"%@", tmpStr1]];<br />
		nextImageView.image = [UIImage imageNamed:tmpStr1];</p>
<p>    }<br />
}</p>
<p>- (void)scrollViewDidEndDecelerating:(UIScrollView *)ascrollView<br />
{<br />
    NSInteger currentPage = (NSInteger)(ascrollView.contentOffset.x/768)+1;<br />
    NSLog(@&#8221;End : currentPage = %d&#8221;,currentPage);<br />
    for (NSInteger i = 1; i &lt;= 5; i++) {<br />
        if (i != currentPage) {<br />
			UIScrollView *currentScroller = (UIScrollView *)[ascrollView viewWithTag:500+i];</p>
<p>            UIImageView *otherImageView = (UIImageView *)[currentScroller viewWithTag:i];<br />
            otherImageView.image = nil;<br />
        }<br />
    }<br />
	UIScrollView *currentScrollerView = (UIScrollView *)[ascrollView viewWithTag:500+currentPage];</p>
<p>    UIImageView *currentView = (UIImageView *)[currentScrollerView viewWithTag:currentPage];<br />
    if (currentView.image == nil) {<br />
  //      NSString *tmpStr = [NSString stringWithFormat:@&quot;fxjyogapic%d.png&quot;,currentPage+1];<br />
        currentView.image = [Manager getImageNoCache:[NSString stringWithFormat:@&quot;002%d.png&quot;, currentPage]];<br />
        //currentView.image = [UIImage imageNamed:[NSString stringWithFormat:@&quot;fxjofficeExciresebg%d.png&quot;,currentPage+1]];<br />
    }<br />
}</p>
<p>- (void)scrollViewDidScrollToTop:(UIScrollView *)ascrollView<br />
{<br />
	NSLog(@&quot;Scrolling tag:%d&quot;,ascrollView.tag);<br />
}</p>
<p>- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale<br />
{</p>
<p>}</p>
<p>- (void)dealloc {<br />
    [super dealloc];<br />
}</p>
<p>@end</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：wait121000</title>
		<link>http://c.gzl.name/about/comment-page-1#comment-302</link>
		<dc:creator>wait121000</dc:creator>
		<pubDate>Sun, 17 Jan 2010 00:20:55 +0000</pubDate>
		<guid isPermaLink="false">http://c.gzl.name/?page_id=2#comment-302</guid>
		<description>看到你收藏了dota replay parser,其中有一句感言对我有用,我给你发邮件了，我邮箱是wuluo110@163.com</description>
		<content:encoded><![CDATA[<p>看到你收藏了dota replay parser,其中有一句感言对我有用,我给你发邮件了，我邮箱是wuluo110@163.com</p>
]]></content:encoded>
	</item>
</channel>
</rss>

