1、初始化
2、常用方法
拼接字符串
判断是否相同字符串
[answer isEqualToString:self.currentModel.answer]//answer==self.currentModel.answer区别
3、方法的比较
NSSttring stringByAppendingString //NSString不可变,每次append生成新的NSString
NSMulbtbleString appendString //NSMulbtbleString操作自身
1 __block NSString * answer = [NSString new]; 2 [self.answerView.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { 3 UIButton * button = (UIButton*)obj; 4 answer = [answer stringByAppendingString:button.currentTitle]; 5 }]; 6 7 8 9 __block NSMutableString * answer = [NSMutableString string]; 10 [self.answerView.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { 11 UIButton * button = (UIButton*)obj; 12 [answer appendString:button.currentTitle]; 13 }];
时间: 2024-10-24 16:49:32