活跃的magnify glass效果开源项目

来源:互联网 发布:windows桌面壁纸 高清 编辑:程序博客网 时间:2024/06/05 14:30

magnifying 放大镜效果,在iOS的note以及其他的一些阅读类应用上,这个使用很平凡,而且看上去非常一致。

ACMagnifyingGlass is a magnifier like the one you can find in the notes iOS app when moving the cursor. 当鼠标/持续touch移动,放大镜把内容放大后显示


Install:

安装采用源代码方式,其中还有一个图作为资源,复制MagnifyingGlass 目录到你的当前项目。


Howto:使用

只要在你的view controller中创建 ACMagnifyingView view (可以是alloc/initWithFrame 或者从 nib文件) ,当你触摸屏幕, 放大镜会出现,放大显示所覆盖区域的view以及子view 

It is possible to use a custom magnifier, like this:

ACMagnifyingGlass *mag = [[ACMagnifyingGlass alloc] initWithFrame:CGRectMake(0, 0, 120, 120)];mag.scale = 2;self.magnifyingView.magnifyingGlass = mag;

If you want a loupe like the real one:

ACLoupe *loupe = [[ACLoupe alloc] init];self.magnifyingView.magnifyingGlass = loupe;

 


screenshots


有些时候,用户不希望在使用textview的时候出现上放的什么“copy”“select all”//

Copy, Cut, Select, Select 所有的功能多默认提供了,只要你持续touch并移动.  

The easiest way is to create a subclass of UITextView that overrides the canPerformAction:withSender:

- (BOOL)canPerformAction:(SEL)action withSender:(id)sender    {         [UIMenuController sharedMenuController].menuVisible = NO;  //do not display the menu     [self resignFirstResponder];                      //do not allow the user to selected anything     return NO;}
HINT:https://github.com/acoomans/iOS-MagnifyingGlass


原创粉丝点击