gpt4 book ai didi

ios - 如何在 irate for ios 中编辑标题和消息?

转载 作者:行者123 更新时间:2023-11-29 13:10:47 25 4
gpt4 key购买 nike

我已经为 irate 添加了 .h .m 和 .bundle 文件。我将预览模式设置为 YES,这样当我的应用程序在我的手机上启动时(我正在测试),Alert View 就会弹出。如果我不将预览模式设置为 YES,它根本不会显示警报 View 。所以现在它弹出评级警报 View 。在 .m 文件中,我尝试编辑字符串中的标题、消息和按钮文本,它仍然显示原始标题、消息和按钮文本,即使它们在 .m 中不存在,因为我已经完全更改了它。有谁知道如何编辑此文本以便编辑显示在警报 View 上的文本。代码如下,因为它来 self 下载的 irate。如果我更改字符串中的文本,当我测试它时它不会改变,它仍然显示现在的内容。在这里兜圈子,我猜我遗漏了一些简单的东西,任何帮助都会很棒!

- (NSString *)messageTitle
{
return [_messageTitle ?: [self localizedStringForKey:iRateMessageTitleKey withDefault:@"Rate %@"] stringByReplacingOccurrencesOfString:@"%@" withString:self.applicationName];
}

- (NSString *)message
{
NSString *message = _message;
if (!message)
{
message = (self.appStoreGenreID == iRateAppStoreGameGenreID)? [self localizedStringForKey:iRateGameMessageKey withDefault:@"If you enjoy playing %@, would you mind taking a moment to rate it? It won’t take more than a minute. Thanks for your support!"]: [self localizedStringForKey:iRateAppMessageKey withDefault:@"If you enjoy using %@, would you mind taking a moment to rate it? It won’t take more than a minute. Thanks for your support!"];
}
return [message stringByReplacingOccurrencesOfString:@"%@" withString:self.applicationName];
}

- (NSString *)cancelButtonLabel
{
return _cancelButtonLabel ?: [self localizedStringForKey:iRateCancelButtonKey withDefault:@"No, Thanks"];
}

- (NSString *)rateButtonLabel
{
return _rateButtonLabel ?: [self localizedStringForKey:iRateRateButtonKey withDefault:@"Rate It Now"];
}

- (NSString *)remindButtonLabel
{
return _remindButtonLabel ?: [self localizedStringForKey:iRateRemindButtonKey withDefault:@"Remind Me Later"];
}

最佳答案

iRate documentation on GitHub 中的建议,有两种方法可以覆盖这些字符串:

1) 您可以在您的应用委托(delegate)初始化类方法中覆盖默认字符串:

+ (void)initialize
{
//overriding the default iRate strings
[iRate sharedInstance].messageTitle = NSLocalizedString(@"Rate MyApp", @"iRate message title");
[iRate sharedInstance].message = NSLocalizedString(@"If you like MyApp, please take the time, etc", @"iRate message");
[iRate sharedInstance].cancelButtonLabel = NSLocalizedString(@"No, Thanks", @"iRate decline button");
[iRate sharedInstance].remindButtonLabel = NSLocalizedString(@"Remind Me Later", @"iRate remind button");
[iRate sharedInstance].rateButtonLabel = NSLocalizedString(@"Rate It Now", @"iRate accept button");
}

2) 推荐的方法是您也可以创建自己的 Localizable.strings 文件并添加在 iRate.h 中找到的那些字符串:

//localisation string keys
static NSString *const iRateMessageTitleKey = @"iRateMessageTitle";
static NSString *const iRateAppMessageKey = @"iRateAppMessage";
static NSString *const iRateGameMessageKey = @"iRateGameMessage";
static NSString *const iRateCancelButtonKey = @"iRateCancelButton";
static NSString *const iRateRemindButtonKey = @"iRateRemindButton";
static NSString *const iRateRateButtonKey = @"iRateRateButton";

例如,在 Localizable.strings 文件中:

"iRateMessageTitle" = "My own rating title";
"iRateAppMessage" = "My own rating message";

关于ios - 如何在 irate for ios 中编辑标题和消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17437851/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com