测试已测试 | ✗ |
Lang语言 | Obj-CObjective C |
许可证 | MIT |
Updated最后更新 | 2015年5月 |
由 Ezequiel Scaruli 维护。
ESFeedbackViewController
是一个 iOS 库,用于在应用中显示反馈界面。它显示一组提示,一个接一个。根据用户在每一步的选择,最终输入可以是
简单地在你的 Podfile 中添加 ESFeedbackViewController
pod 'ESFeedbackViewController'
在你的 AppDelegate
中,一旦应用完成启动,添加
#import <ESFeedbackViewController/ESFeedbackViewController.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
...
// The required number of application launches to show the feedback screen.
[ESFeedbackViewController setNumberOfLaunchesToShow:NUMBER_OF_LAUNCHES];
// The app ID, required to show redirect the user to the App Store.
[ESFeedbackViewController setAppID:APP_ID];
// Register that the application was launched.
[ESFeedbackViewController registerAppLaunch];
...
}
一旦调用过 [ESFeedbackViewController registerAppLaunch]
,就可以在任何应用点使用 showIfNecessary
方法显示反馈界面。例如
@implementation MyViewController
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[ESFeedbackViewController showIfNecessary];
}
@end
为了跟踪用户逐步进行的输入,提供了一个回调。它会在用户关闭每个提示时被调用。它接收一个表示关闭提示的视图控制器,以及一个布尔值,指示用户是否选择继续或取消。可用于向分析/后端服务器发送输入以便存储
[ESFeedbackViewController setOnPromptWasDismissed:^(ESFeedbackPromptViewController *promptVC, BOOL ok) {
NSLog(ok ? @"Pressed OK" : @"Pressed Cancel");
if (promptVC.inputText.length > 0) {
// If the prompt view controller has any way to input text, it can be accessed through the inputText property.
NSLog(@"Input text: %@", promptVC.inputText);
}
}];
作为 UI 扩展,可以自定义文本和按钮字体
[ESFeedbackViewController setTextFont:TEXT_FONT];
[ESFeedbackViewController setButtonsFont:BUTTONS_FONT];
此库受以下 MIT 许可证。