iOS:在TableView上分层UILabel

时间:2017-03-04 20:16:19

标签: ios swift uitableview uilabel

当我们在应用中遇到网络连接错误时,我们想在我们的表视图顶部添加“无连接”标签,如下图所示。

如何有条件地在表格视图上叠加标签?

enter image description here

2 个答案:

答案 0 :(得分:0)

另一种选择是在keyWindow上添加图层,但确保在动画后删除。

void encrypt(char inputText[], int inputLength)
{
    printf("%s\n",inputText);
    char *begin = inputText;
    char *end = inputText + inputLength - 1;
    char temp;
    while(end > begin)
      {
        temp = *end;
        *end-- = *begin;
        *begin++ = temp;
      }

    char *ascii_pointer;
    char temporary;
    // ascii_pointer = inputText + 1; => you miss the first character
    ascii_pointer = inputText;
    temporary = *ascii_pointer;

    int *p;
    int array[512];
    p = array;
    while(ascii_pointer < inputText + inputLength)
      {
        printf("INPUTTEXT: ascii_pointer: %s\n " , ascii_pointer);
        temporary = *ascii_pointer++;
        printf("temporary: %c\n " , temporary);
        // *p = temporary++; => you always write at the first array position
        *p++ = temporary++;
        printf("ascii_array: %d\n ", *array);
        printf("\n");
      }
    printf("\n");
    printf("END: %p:%c\n", p, *p);
    printf("END--- MAYBE GARBAGE VALUE: place holder: %c\n ",temporary);
    // printf("END: ascii_array: %d\n ", *array); => you print only the first array element
    printf("END: ascii_array: ");
    p = array;
    while (p < array + inputLength)
      printf("%d ", *p++);
    printf("\n");
    return;
}

答案 1 :(得分:-1)

创建一个自定义UIView,您将通过表视图将其作为子视图添加到viewController.view,并为其显示和消失动作设置动画。