[翻译] EAIntroView

简介:

EAIntroView

https://github.com/ealeksandrov/EAIntroView

 

This is highly customizable drop-in solution for introduction views. Some features (remember, most features are optional and can be turned off):

这是一个高度可定制的导航页解决方案,这是一些特性(记住,大部分特性都是可选的,以及可以关闭的):

  • beautiful demo project to look on some examples 一个漂亮的demo演示了好多例子
    • customizability is unlimited, one can make complex introView with animations and interactive pages, so do not limit yourself with existing examples
    • 定制是完全没有限制的.发挥你的想象力,不要局限于提供的几个例子
  • for each basic page: 对于每一个基本的页面
    • background (with cross-dissolve transition between pages) 背景
    • custom iOS7 motion effects (parallax) on background iOS7的视差效果
    • title view (+ Y position) 标题view
    • title text (+ font, color and Y position) 标题文本
    • description text (+ font, color, width and Y position) 描述文本
    • subviews array (added to page after building default layout) 子类view构成的数组
  • possibility to set your own custom view for page: 你也可以设计自定义view
    • pageWithCustomView: 
    • pageWithCustomViewFromNibNamed:
  • possibility to set block action on page events: 你也可以设定每页的事件触发
    • pageDidLoad
    • pageDidAppear
    • pageDidDisappear
  • many options to customize parent view: 你还可以设定父视图
    • swipe from last page to close
    • switching pages with one simple tap
    • custom background image or color
    • custom page control
    • custom skip button
    • pinned titleView (+ Y position, can be hidden on some pages)
  • delegate protocol to listen: 监听代理
    • introDidFinish:
    • intro:pageAppeared:withIndex:
  • actions on IntroView: IntroView上面的行为设定
    • setPages:
    • showInView:animateDuration:
    • hideWithFadeOutDuration:
    • setCurrentPageIndex:animated:
  • storyboard/IB support

 

CocoaPods

CocoaPods is the recommended way to use EAIntroView in your project. 你可以用 CocoaPods 来安装

  • Simply add this line to your Podfilepod 'EAIntroView', '~> 2.7.0' 将pod 'EAIntroView', '~> 2.7.0'添加到你的Podfile中
  • Run pod install. 运行 pod install
  • Include with #import "EAIntroView.h" to use it wherever you need. 导入头文件#import "EAIntroView.h"
  • Subscribe to the EAIntroDelegate to enable delegate/callback interaction. 实现代理方法即可

 

Manual installation

  • Add EAIntroPage and EAIntroView headers and implementations to your project (4 files total). 将 EAIntroPage.h/m 与 EAIntroView.h/m 添加到你的项目当中.
  • Add EARestrictedScrollView header and implementation to your project (2 files total). 将  EARestrictedScrollView  添加到你的项目当中.
  • Include with #import "EAIntroView.h" to use it wherever you need. 导入头文件#import "EAIntroView.h"
  • Subscribe to the EAIntroDelegate to enable delegate/callback interaction. 实现代理方法即可

 

How To Use It

Sample project have many examples of customization. Here are only simple ones.

项目中已经包含了好多例子,这里简单的列举一例:

 

Step 1 - Build Pages

Each page created with [EAIntroPage page] class method. Then you can customize any property, all of them are optional. Another approach is to pass your own (can be nib), custom view in EAIntroPage, this way most other options are ignored.

每一页都是由方法 [EAIntroPage page] 生成.然后,你可以自定义这些属性.当然,你也可以用你自己的方式创建出自定义的EAIntroPage,不过,这种方式的话,好多设置都被忽略了.

// basic
EAIntroPage *page1 = [EAIntroPage page];
page1.title = @"Hello world";
page1.desc = sampleDescription1;
// custom EAIntroPage *page2 = [EAIntroPage page]; page2.title = @"This is page 2"; page2.titleFont = [UIFont fontWithName:@"Georgia-BoldItalic" size:20]; page2.titlePositionY = 220; page2.desc = sampleDescription2; page2.descFont = [UIFont fontWithName:@"Georgia-Italic" size:18]; page2.descPositionY = 200; page2.titleIconView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"title2"]]; page2.titleIconPositionY = 100; // custom view from nib EAIntroPage *page3 = [EAIntroPage pageWithCustomViewFromNibNamed:@"IntroPage"]; page3.bgImage = [UIImage imageNamed:@"bg2"];

 

Step 2 - Create Introduction View

Once all pages have been created, you are ready to create the introduction view. Just pass them in right order in the introduction view. You can also pass array of pages after IntroView's initialization, it will rebuild its contents.

一旦所有页码都创建出来了,你就可以创建出介绍页了.你只要按照顺序传入参数即可.

EAIntroView *intro = [[EAIntroView alloc] initWithFrame:self.view.bounds andPages:@[page1,page2,page3,page4]];

Don't forget to set the delegate if you want to use any callbacks.

不要忘记设置代理.

[intro setDelegate:self];

 

Step 3 - Show Introduction View

[intro showInView:self.view animateDuration:0.0];

 

Storyboard/IB

Since 1.3.0 EAIntroView supports init from IB. Since 2.0.0 EAIntroPage supports it too.

1.3.0版本的EAIntroView支持从IB创建.2.0.0版本的EAIntroPage也支持从IB创建.

  1. Drop UIView to your IB document. 设置一个IB的UIView
  2. Set its class to EAIntroView. 将其类别设置成EAIntroView
  3. Create IBOutlet property in your view controller: @property(nonatomic,weak) IBOutlet EAIntroView *introView;. 从你的控制器创建出属性@property(nonatomic,weak) IBOutlet EAIntroView *introView;
  4. Connect IBOutlet with EAIntroView in IB. 通过IB连接EAIntroView
  5. Build array of pages (you can use pageWithCustomViewFromNibNamed: here with separate nibs for each page). 然后,你就可以创建每一页了
  6. Pass pages array to EAIntroView property in setPages:. 将page数组的值赋给EAIntroView的setPages属性

 

Author

Created and maintained by Evgeny Aleksandrov (@EAleksandrov).

 

License

EAIntroView is available under the MIT license. See the LICENSE file for more info.

 

目录
相关文章
|
11月前
|
数据采集 Web App开发 JavaScript
Puppeteer自动化:使用JavaScript定制PDF下载
在现代Web开发中,自动化工具如Puppeteer可显著提升效率并减少重复工作。Puppeteer是一款强大的Node.js库,能够控制无头Chrome或Chromium浏览器,适用于网页快照生成、数据抓取及自动化测试等任务。本文通过示例展示了如何使用Puppeteer自动化生成定制化的PDF文件,并介绍了如何通过配置代理IP、设置user-agent和cookie等技术增强自动化过程的灵活性与稳定性。具体步骤包括安装Puppeteer、配置代理IP、设置user-agent和cookie等,最终生成符合需求的PDF文件。此技术可应用于报表生成、发票打印等多种场景。
430 6
Puppeteer自动化:使用JavaScript定制PDF下载
|
缓存 测试技术 API
API的封装步骤流程
API封装流程是一个系统化的过程,旨在将内部功能转化为可复用的接口供外部调用。流程包括明确需求、设计接口、选择技术和工具、编写代码、测试、文档编写及部署维护。具体步骤为确定业务功能、数据来源;设计URL、请求方式、参数及响应格式;选择开发语言、框架和数据库技术;实现数据连接、业务逻辑、错误处理;进行功能、性能测试;编写详细文档;部署并持续维护。通过这些步骤,确保API稳定可靠,提高性能。
|
传感器 数据采集 存储
以下是一个简化的环境监测系统工程概述,并附带有Python代码示例或详解。
以下是一个简化的环境监测系统工程概述,并附带有Python代码示例或详解。
|
10月前
|
传感器 安全 物联网
新技术潮流之巅:区块链、物联网与虚拟现实的融合与创新
在数字时代的浪潮中,新兴技术不断涌现,重塑着我们的工作和生活方式。本文将深入探讨三项引领未来的技术:区块链、物联网(IoT)和虚拟现实(VR),并揭示它们如何独立发展同时又相互交织,共同构建一个更加智能、互联的世界。我们将从技术的基本原理出发,探索它们在实际应用场景中的革新作用,以及这些技术融合后所带来的全新可能性。通过具体案例分析,本文旨在为读者提供一个关于未来技术趋势及其应用的全面视角。
175 7
|
10月前
|
搜索推荐 数据挖掘 API
API接口在电商的应用及收益
本文探讨了API接口技术在电商领域的应用及其带来的收益。API接口作为连接电商平台与外部系统的桥梁,实现了高效、实时的数据交换和集成,提升了用户体验、运营效率和市场竞争力。具体应用包括库存管理、支付网关、物流跟踪、自动化业务流程、个性化推荐和精准营销等方面。通过实战案例分析,展示了亚马逊和小型电商公司如何利用API接口实现自动化管理,提高了工作效率和客户满意度。未来,API接口技术将更加注重智能化、标准化、安全性和跨界合作。
420 3
Spring Boot 一个接口同时支持 form 表单、form-data、json 优雅写法
网上很多代码都是千篇一律的 cvs,相信我只要你认真看完我写的这篇,你就可以完全掌握这个知识点,这篇文章不适合直接 cvs,一定要先理解。
|
API 数据处理 数据库
产品服务性能参数
产品服务性能参数
400 4
|
NoSQL Linux Redis
M1-Mac中docker的redis集群配置
M1-Mac中docker的redis集群配置
246 1
|
Java 数据库连接 数据库
(mybatis与spring集合
(mybatis与spring集合
85 0
|
存储 关系型数据库 MySQL
【MySQL从入门到精通】【高级篇】(八)聚簇索引&非聚簇索引&联合索引
上一篇文章我们介绍了【MySQL从入门到精通】【高级篇】(七)设计一个索引&InnoDB中的索引方案,该文介绍了如何设计一个索引,以及InnoDB中的索引如何形成。
461 0
【MySQL从入门到精通】【高级篇】(八)聚簇索引&非聚簇索引&联合索引