[翻译] BKZoomView

BKZoomView

https://github.com/freshking/BKZoomView

A UIView that will zoom into its parent view. It can be implemented with only three lines of code and is very easy to use. It is optionally drag-able with a customizable zoom scale.

一个UIView,用来放大它的父类view,非常容易使用,仅需3行代码。支持拖动这个view,并定制缩放比例。

How to

Initialize the zoom view anywhere in a view.

在一个view中初始化一个区域。

BKZoomView *zoomView = [[BKZoomView alloc] initWithFrame:CGRectMake(0, 280, self.view.frame.size.width, 150)];
[zoomView setZoomScale:2.0];
[zoomView setDragingEnabled:NO];
[self.view addSubview:zoomView];

Options:

  1. setZoomScale: Here you can set the zoom value (Standard = 2.0) 设置放大区域(默认值为2.0)
  2. setDragingEnabled: Here you can decide wether the user can drag the zoom view around or if it is static. If static, then the user can touch throuch this view which is nice if you place it over a UITableView and still want to scroll. 设置是否可以拖动:在这里,你可以设置用户是否可以拖动这个view,你也可以设置成静态的。

Important:

[zoomview setNeedsDisplay] must be called everytime you want to update the zoom view. For example the zoom view is placed over a UITableView and you want a live zoom when scrolling, then you must implement this in the scrollViewDidScroll: method. Exception here is when dragging.

[zoomview setNeedsDisplay]在你更新缩放view的时候必须每次都调用。如果在scrollView中调用的话,你在scrollViewDidScroll:方法中调用就行了。

For further information please check out the example application.

更多的信息,请检查demo项目工程。

原文地址:https://www.cnblogs.com/YouXianMing/p/3997711.html