美文网首页
判断提示框状态

判断提示框状态

作者: 还好我不懂 | 来源:发表于2016-06-30 13:52 被阅读9次
    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);
    }

    1. 判断状态
      NSString *alert = nil;
      if (isEmpty(bankName)) {
      alert = @"信息不能为空";
      }else if (isEmpty(salePointName)) {
      alert = @"信息不能为空";
      }else if (isEmpty(accountName)) {
      alert = @"不能为空";
      }else {

      }

    2. 显示状态
      if (isEmpty(alert)) {
      // 显示提示
      [self showOnlyTextDialog:alert];
      }else{

      }

    相关文章

      网友评论

          本文标题:判断提示框状态

          本文链接:https://www.haomeiwen.com/subject/attfjttx.html