您好,登錄后才能下訂單哦!
雙擊放大是 iPhone 的一個基本操作,第三方程序里引入這一功能的話,主要是在 scrollview 呈現一張圖片或者 PDF 頁面時,雙擊可以放大,主要代碼如下
- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale
{
NSLog(@"%s", _cmd);
CGFloat zs = scrollView.zoomScale;
zs = MAX(zs, 0.1);
zs = MIN(zs, 5.0);
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
scrollView.zoomScale = zs;
[UIView commitAnimations];
}
#pragma mark -
#pragma mark === UITouch Delegate ===
#pragma mark -
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
//NSLog(@"%s", _cmd);
UITouch *touch = [touches anyObject];
if ([touch tapCount] == 2)
{
//NSLog(@"double click");
CGFloat zs = self.zoomScale;
zs = (zs == 1.0) ? 2.0 : 1.0;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
self.zoomScale = zs;
[UIView commitAnimations];
}
}
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。