我希望这个问题很简单。我有我在课堂上使用的所有字符串。这些字符串与其他数据一起附加到单个字符串中,以创建可读的输出字符串。
目前我有一个方法,我只是按照方法本身底部列出的完全初始化所有字符串。我打算在类中创建多个其他方法来使用这些相同的字符串,所以我的问题是.. 简单地将它们设为所有属性并初始化它们是否是一种很好的做法,以便它们可以在整个类中使用,如下例所示(我知道不工作的代码)。或者有没有更好的方法我应该解决这个问题,我知道它会按照我的建议工作,但作为一个新手,我想在某个时候学习正确的做事方式。提前欢呼任何帮助。
@界面
@property(强,非原子)NSString *lbLabel;
... .. .. ..对于每一个.. @end
@执行
-(id)init { self.lbLabel = NSLocalizedString(@"lb", @"lb"); .... 其余的以此类推...... }
@结尾
// English
NSString *lbLabel = NSLocalizedString(@"lb", @"lb");
NSString *mLabel = NSLocalizedString(@"m", @"m");
NSString *mphLabel = NSLocalizedString(@"mph", @"mph");
NSString *inchLabel = NSLocalizedString(@"in", @"in");
// Metric
NSString *kgLabel = NSLocalizedString(@"kg", @"kg");
NSString *kLabel = NSLocalizedString(@"k", @"k");
NSString *kphLabel = NSLocalizedString(@"kp/h", @"kp/h");
NSString *cmLabel = NSLocalizedString(@"cm", @"cm");
//Both
NSString *liftLabel = NSLocalizedString(@"Lift:", @"Lift:");
NSString *calisthenicLabel = NSLocalizedString(@"Calisthenic:", @"Calisthenic:");
NSString *cardioLabel = NSLocalizedString(@"Cardio:", @"Cardio:");
NSString *metricsLabel = NSLocalizedString(@"Metrics:", @"Metrics:");
NSString *commentLabel = NSLocalizedString(@"Comment:", @"Comment");
NSString *setLabel = NSLocalizedString(@"Set:", @"Set:");
NSString *repsLabel = NSLocalizedString(@"Reps:", @"Reps:");
NSString *weightLabel = NSLocalizedString(@"Weight:", @"Weight:");
//Cardio Labels
NSString *timeLabel = NSLocalizedString(@"Time:", @"Time:");
NSString *distanceLabel = NSLocalizedString(@"Distance:", @"Distance:");
NSString *rateLabel = NSLocalizedString(@"Rate:", @"Rate:");
NSString *settingOneLabel = NSLocalizedString(@"Setting 1:", @"Setting 1:");
NSString *settingOneValueLabel = NSLocalizedString(@"Setting 1 Value:", @"Setting 1 Value:");
NSString *settingTwoLabel = NSLocalizedString(@"Setting 2:", @"Setting 2:");
NSString *settingTwoValueLabel = NSLocalizedString(@"Setting 2 Value:", @"Setting 2 Value:");
NSString *caloriesLabel = NSLocalizedString(@"Calories:", @"Calories:");
//Metrics Labels
NSString *heightLabel = NSLocalizedString(@"Height:", @"Height:");
NSString *neckLabel = NSLocalizedString(@"Neck:", @"Neck:");
NSString *chestLabel = NSLocalizedString(@"Chest:", @"Chest:");
NSString *waistLabel = NSLocalizedString(@"Waist:", @"Waist:");
NSString *hipsLabel = NSLocalizedString(@"Hips:", @"Hips:");
NSString *bicepsLabel = NSLocalizedString(@"Biceps:", @"Biceps:");
NSString *ForearmsLabel = NSLocalizedString(@"Forearms:", @"Forearms:");
NSString *wristsLabel = NSLocalizedString(@"Wrists:", @"Wrists:");
NSString *quadsLabel = NSLocalizedString(@"Quads/Thighs:", @"Quads/Thighs:");
NSString *calvesLabel = NSLocalizedString(@"Calves:", @"Calves:");
NSString *anlklesLabel = NSLocalizedString(@"Ankles:", @"Ankles:");
NSString *feetLabel = NSLocalizedString(@"Feet:", @"Feet:");
NSString *bmiLabel = NSLocalizedString(@"BMI:", @"BMI:");
NSString *bmrLabel = NSLocalizedString(@"BMR:", @"BMR:");
NSString *waistHeightLabel = NSLocalizedString(@"Waist/Height:", @"Waist/Height:");
NSString *waistHipsLabel = NSLocalizedString(@"Waist/Hips:", @"Waist/Hips:");
// English
NSString *lbLabel = NSLocalizedString(@"lb", @"lb");
NSString *mLabel = NSLocalizedString(@"m", @"m");
NSString *mphLabel = NSLocalizedString(@"mph", @"mph");
NSString *inchLabel = NSLocalizedString(@"in", @"in");
// Metric
NSString *kgLabel = NSLocalizedString(@"kg", @"kg");
NSString *kLabel = NSLocalizedString(@"k", @"k");
NSString *kphLabel = NSLocalizedString(@"kp/h", @"kp/h");
NSString *cmLabel = NSLocalizedString(@"cm", @"cm");
//Both
NSString *liftLabel = NSLocalizedString(@"Lift:", @"Lift:");
NSString *calisthenicLabel = NSLocalizedString(@"Calisthenic:", @"Calisthenic:");
NSString *cardioLabel = NSLocalizedString(@"Cardio:", @"Cardio:");
NSString *metricsLabel = NSLocalizedString(@"Metrics:", @"Metrics:");
NSString *commentLabel = NSLocalizedString(@"Comment:", @"Comment");
NSString *setLabel = NSLocalizedString(@"Set:", @"Set:");
NSString *repsLabel = NSLocalizedString(@"Reps:", @"Reps:");
NSString *weightLabel = NSLocalizedString(@"Weight:", @"Weight:");
//Cardio Labels
NSString *timeLabel = NSLocalizedString(@"Time:", @"Time:");
NSString *distanceLabel = NSLocalizedString(@"Distance:", @"Distance:");
NSString *rateLabel = NSLocalizedString(@"Rate:", @"Rate:");
NSString *settingOneLabel = NSLocalizedString(@"Setting 1:", @"Setting 1:");
NSString *settingOneValueLabel = NSLocalizedString(@"Setting 1 Value:", @"Setting 1 Value:");
NSString *settingTwoLabel = NSLocalizedString(@"Setting 2:", @"Setting 2:");
NSString *settingTwoValueLabel = NSLocalizedString(@"Setting 2 Value:", @"Setting 2 Value:");
NSString *caloriesLabel = NSLocalizedString(@"Calories:", @"Calories:");
//Metrics Labels
NSString *heightLabel = NSLocalizedString(@"Height:", @"Height:");
NSString *neckLabel = NSLocalizedString(@"Neck:", @"Neck:");
NSString *chestLabel = NSLocalizedString(@"Chest:", @"Chest:");
NSString *waistLabel = NSLocalizedString(@"Waist:", @"Waist:");
NSString *hipsLabel = NSLocalizedString(@"Hips:", @"Hips:");
NSString *bicepsLabel = NSLocalizedString(@"Biceps:", @"Biceps:");
NSString *ForearmsLabel = NSLocalizedString(@"Forearms:", @"Forearms:");
NSString *wristsLabel = NSLocalizedString(@"Wrists:", @"Wrists:");
NSString *quadsLabel = NSLocalizedString(@"Quads/Thighs:", @"Quads/Thighs:");
NSString *calvesLabel = NSLocalizedString(@"Calves:", @"Calves:");
NSString *anlklesLabel = NSLocalizedString(@"Ankles:", @"Ankles:");
NSString *feetLabel = NSLocalizedString(@"Feet:", @"Feet:");
NSString *bmiLabel = NSLocalizedString(@"BMI:", @"BMI:");
NSString *bmrLabel = NSLocalizedString(@"BMR:", @"BMR:");
NSString *waistHeightLabel = NSLocalizedString(@"Waist/Height:", @"Waist/Height:");
NSString *waistHipsLabel = NSLocalizedString(@"Waist/Hips:", @"Waist/Hips:");