@(逆向之师傅和我)
经常出现重复定义这样的问题。那么我们就要去给他设置域。这个是结果.
#import "ViewController.h"
#import "NSString+LRExtension.h"
#define LWUpDefineFunction(name,key) \
{\
NSString *add = [NSString stringWithFormat:@"temp-%@",name];\
NSString *up = [add uppercaseString];\
key = up;\
}
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UILabel *resultLabel;
@property (weak, nonatomic) IBOutlet UITextField *textFiled;
@property (weak, nonatomic) IBOutlet UILabel *otehrLabel;
@end
@implementation ViewController
- (void)viewDidLoad{
[super viewDidLoad];
{
NSString *name = @"wangxin";
}
NSString *k1 = nil;
LWUpDefineFunction(@"adsf",k1)
NSLog(@"k1 = %@",k1);
NSString *k2 = nil;
LWUpDefineFunction(@"tttk2",k2)
NSLog(@"k2 = %@",k2);
/**
NSString *name = @"Lnm";
NSLog(@"%@",[self up:name]);
*/
}
PS:加一个东西,防止以往
- (BOOL)isIncludeSpecialCharact{
//提示 标签不能输入特殊字符
NSString *SpecialStr =@"^[A-Za-z0-9\\u4e00-\u9fa5]+$";
NSPredicate* emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", SpecialStr];
if (![emailTest evaluateWithObject:self]) {
return YES;
}
return NO;
}