GithubHelp home page GithubHelp logo

enmaskedpopover's Introduction

ENMaskedPopOver

A lightweight PopOver view.

一个轻量级的文本弹出信息视图

Demo Time

Demo Demo 1

Requirement

iOS 7+

Usage

Automatically calculates the relative position, determine location and orientation of the arrow.

// in ViewController.m
[ENMaskedPopOver showPopOverText:@"这是一个独立的提示信息view,只需要一句话就可以完成整个事情" 
                 attributes:@{NSFontAttributeName: [UIFont systemFontOfSize:12], NSForegroundColorAttributeName: [UIColor blackColor]} 
                 inView:self.view 
                 basedOn:sender];

Parameters

  • inView : The masked-popover gonna show in.
  • basedOn : The view should be frame of reference to this masked-popover.

note: inView could be other view. For example, if you want to cover the navigation bar, which I dont't like this approach, you just use it like this:

// in ViewController.m
[ENMaskedPopOver showPopOverText:@"这是一个独立的提示信息view,只需要一句话就可以完成整个事情" 
                 attributes:@{NSFontAttributeName: [UIFont systemFontOfSize:12], NSForegroundColorAttributeName: [UIColor blackColor]} 
                 inView:[[UIApplication sharedApplication].windows firstObject] 
                 basedOn:sender];

系统要求

iOS 7+

使用方法

自动计算相对位置,算出箭头所处的位置和朝向

// in ViewController.m
[ENMaskedPopOver showPopOverText:@"这是一个独立的提示信息view,只需要一句话就可以完成整个事情" 
                 attributes:@{NSFontAttributeName: [UIFont systemFontOfSize:12], NSForegroundColorAttributeName: [UIColor blackColor]} 
                 inView:self.view 
                 basedOn:sender];

参数

  • inView : 文本弹出层的遮罩在哪个view中
  • basedOn : 文本弹出层应该以哪个view作为计算的参考view

注意: inView 这个参数可以是其他的view。比如说, 如果你想弹出层能够遮住navigationbar(我个人很不喜欢这种交互),你可以这样做:

// in ViewController.m
[ENMaskedPopOver showPopOverText:@"这是一个独立的提示信息view,只需要一句话就可以完成整个事情" 
                 attributes:@{NSFontAttributeName: [UIFont systemFontOfSize:12], NSForegroundColorAttributeName: [UIColor blackColor]} 
                 inView:[[UIApplication sharedApplication].windows firstObject] 
                 basedOn:sender];

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.