Just add the MNFloatBtn
folder to your project
Use CocoaPods with Podfile:
pod 'MNFloatBtn'
github "miniLV/MNFloatBtn"
- The floating button is displayed in any case
[MNFloatBtn show];
- Display the floating button only in Debug mode (recommended)
[MNFloatBtn showDebugModeWithType:MNAssistiveTypeNone];
- remove floating button
[MNFloatBtn hidden];
- touch event
[MNFloatBtn sharedBtn].btnClick = ^(UIButton *sender) {
NSLog(@" btn.btnClick ~");
};
- The current date is displayed by default
[[MNFloatBtn sharedBtn] setBuildShowDate:YES];
- Configure the api environment display
#define kAddress @"testapi.miniLV.com"
//#define kAddress @"devapi.miniLV.com"
//#define kAddress @"api.miniLV.com"
//Configure yourself - what api environment, what label to display
NSDictionary *envMap = @{
@"test":@"testapi.miniLV.com",
@"dev":@"devapi.miniLV.com",
@"pro":@"api.miniLV.com"
};
//Set different titles to be displayed in different environments, as well as the current Host
[[MNFloatBtn sharedBtn]setEnvironmentMap:envMap currentEnv:kAddress];
1.CocoaPods : pod 'MNFloatBtn'
2.手动导入 : 拖入MNFloatBtn
文件夹
- 导入头文件,
#import <MNFloatBtn/MNFloatBtn.h>
- 一行代码,显示悬浮按钮
- 任何情况都显示悬浮按钮
[MNFloatBtn show];
- 仅在Debug模式下显示悬浮按钮(推荐使用)
[MNFloatBtn showDebugModeWithType:MNAssistiveTypeNone];
- 移除悬浮按钮在界面上显示
[MNFloatBtn hidden];
- 按钮点击事件
[MNFloatBtn sharedBtn].btnClick = ^(UIButton *sender) {
NSLog(@" btn.btnClick ~");
};
- 默认显示当前日期
[[MNFloatBtn sharedBtn] setBuildShowDate:YES];
- 配置api环境显示
#define kAddress @"testapi.miniLV.com"
//#define kAddress @"devapi.miniLV.com"
//#define kAddress @"api.miniLV.com"
//自己配置 - 什么api环境下,要显示什么标签
NSDictionary *envMap = @{
@"测试":@"testapi.miniLV.com",
@"开发":@"devapi.miniLV.com",
@"生产":@"api.miniLV.com"
};
//设置不同环境下,要展示的不同title,以及当前的Host
[[MNFloatBtn sharedBtn]setEnvironmentMap:envMap currentEnv:kAddress];
如果你在天朝,可以看这篇中文博客 文章介绍