Github 地址:https://github.com/xiaofei86/XFAssistiveTouch
Weibo 地址:http://weibo.com/1750985774/DyST3Czzc
XFAssistiveTouch 是仿照 iOS 系統(tǒng)的輔助按鈕 AssistiveTouch 制作的輔助按鈕。你可以用在調(diào)試等場(chǎng)景中使用。
Getting Started
- 閱讀本篇博客或 README 文檔 了解 XFAssistiveTouch
- 下載 XFAssistiveTouch 運(yùn)行 Examples 文件夾中的示例查看效果
- 參考 Installation 章節(jié)將 XFAssistiveTouch 集成在你的項(xiàng)目中
- 參考 Usage 章節(jié)或示例代碼在你的項(xiàng)目中使用 XFAssistiveTouch
Communication
- 如果你需要使用上的幫助,請(qǐng)聯(lián)系我 xuyafei86@163.com 。
- 如果你有使用上通用的問(wèn)題,請(qǐng)新建 Issue。
- 如果你發(fā)現(xiàn) BUG,請(qǐng)新建 Issue。
- 如果你對(duì) XFAssistiveTouch 有新的需求,請(qǐng)新建 Issue。
- 如果你想幫助改善 XFAssistiveTouch,請(qǐng)?zhí)峤?Pull Request。
Installation
XFAssistiveTouch 支持兩種方式來(lái)安裝
使用 cocoapods 安裝
pod 'XFAssistiveTouch', '~>0.0.1'
通過(guò) clone/download 安裝
- 將 XFAssistiveTouch clone 或 download 到本地
- 將 XFAssistiveTouch 文件夾中的所有文件復(fù)制到你的項(xiàng)目中
Usage
顯示 XFAssistiveTouch
- 導(dǎo)入頭文件
#import "XFAssistiveTouch.h"
- 初始化 XFAssistiveTouch
XFAssistiveTouch *assistiveTouch = [XFAssistiveTouch sharedInstance];
assistiveTouch.delegate = self;
[assistiveTouch showAssistiveTouch];
- 實(shí)現(xiàn) XFXFAssistiveTouchDelegate 來(lái)初始化 XFXFAssistiveTouch 的首頁(yè)
@protocol XFXFAssistiveTouchDelegate <NSObject>
- (NSInteger)numberOfItemsInViewController:(XFATViewController *)viewController;
- (XFATItemView *)viewController:(XFATViewController *)viewController itemViewAtPosition:(XFATPosition *)position;
- (void)viewController:(XFATViewController *)viewController didSelectedAtPosition:(XFATPosition *)position;
@end
操作 XFXFAssistiveTouch
在實(shí)現(xiàn) XFXFAssistiveTouchDelegate 時(shí),你可以給首頁(yè)的 XFATItemView 添加手勢(shì)以便在點(diǎn)擊的時(shí)候?qū)?XFXFAssistiveTouch 或你項(xiàng)目的 UIViewController 進(jìn)行交互。
XFXFAssistiveTouch 可進(jìn)行的交互
- 展開(kāi) XFXFAssistiveTouch
- (void)spread;
- 收起 XFXFAssistiveTouch
- (void)shrink;
- 在 XFXFAssistiveTouch 展示下級(jí) XFATViewController
- (void)pushViewController:(XFATViewController *)viewController atPisition:(XFATPosition *)position;
- 回到 XFXFAssistiveTouch 上級(jí)頁(yè)面
- (void)popViewController;
XFXFAssistiveTouch 可與項(xiàng)目進(jìn)行的交互
- 在 targetViewcontroller 中 push 或 present 提供的 viewController。
- (void)pushViewController:(UIViewController *)viewController atViewController:(UIViewController *)targetViewController;
- 自動(dòng)找到項(xiàng)目中最上層的 ViewController push 或 present 提供的 viewController。
- (void)pushViewController:(UIViewController *)viewController;
Architecture
交互
文件
類 | 說(shuō)明 |
---|---|
XFATLayoutAttributes | 提供方法返回某些固定的坐標(biāo)和大小,用來(lái)適配 iPhone 和 iPad。 |
XFATPosition | 對(duì)位置信息進(jìn)行封裝以隱藏計(jì)算細(xì)節(jié),項(xiàng)目中傳遞位置信息的容器。 |
XFATItemView | 項(xiàng)目中的基本視圖,每個(gè)頁(yè)面由最多 8 個(gè)組成。 |
XFATViewController | 頁(yè)面控制器,控制最多 8 個(gè) XFATItemView |
XFATNavigationController | 控制多個(gè) XFATViewController 的切換、返回、展開(kāi)、收起、移動(dòng)、隱藏等行為及動(dòng)畫(huà)。 |
XFATRootViewController | 繼承自 XFATViewController,XFAssistiveTouch 的首頁(yè)。 |
XFAssistiveTouch | 用頂層 UIWindow 展示 XFATNavigationController。用戶只需直接與此類進(jìn)行交互。 |