NSArray *values = @[@"1", @"2", @"3", nil];
NSString *bankName =values[0][0];
NSString *salePointName =values[0][1];
NSString *accountName =values[0][2];
// 判断text是否为空
static BOOL isEmpty(id thing) {
return thing == nil
|| [thing isKindOfClass:[NSNull class]]
|| ([thing respondsToSelector:@selector(length)]
&& [(NSData *)thing length] == 0)
|| ([thing respondsToSelector:@selector(count)]
&& [(NSArray *)thing count] == 0);
}
-
判断状态
NSString *alert = nil;
if (isEmpty(bankName)) {
alert = @"信息不能为空";
}else if (isEmpty(salePointName)) {
alert = @"信息不能为空";
}else if (isEmpty(accountName)) {
alert = @"不能为空";
}else {}
-
显示状态
if (isEmpty(alert)) {
// 显示提示
[self showOnlyTextDialog:alert];
}else{}
网友评论