我为irate添加了.h .m和.bundle文件。我将预览模式设置为YES,这样当我的应用程序在手机上启动时,警报视图就会弹出(我正在测试)。如果我没有将预览模式设置为YES,它根本不显示警报视图。 所以现在它会弹出评级警报视图。在.m文件中,我尝试编辑字符串中的标题,消息和按钮文本,它仍然显示原始标题,消息和按钮文本,即使它在.m中不存在,因为我已完全更改它。有没有人知道如何编辑此文本,以便它将编辑警报视图上显示的文本。代码如下,因为它来自我的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"];
}
答案 0 :(得分:1)
正如iRate documentation on GitHub中所建议的,有两种方法可以覆盖这些字符串:
1)您可以覆盖app delegate initialize类方法中的默认字符串:
+ (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";