在Swift代码中,我的标签未显示在ViewController中

时间:2019-04-05 19:10:06

标签: ios swift textview viewcontroller

在手机上显示ViewController时,标签不显示

我是iOS的新手,很快,我对YouTube进行了广泛搜索,但无济于事。在代码中,您可以看到我已经尝试过两次添加两个标签。并不是没有人显示。导航元素正常工作。也正确设置了背景。

$ valgrind ./bin/letters
==4735== Memcheck, a memory error detector
==4735== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==4735== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
==4735== Command: ./bin/letters
==4735==
amy has 1 letters from
  spammer  10
bob has 3 letters from
  spammer  30
  spammer  30
  spammer  30
claud has 2 letters from
  spammer  20
  spammer  20
==4735==
==4735== HEAP SUMMARY:
==4735==     in use at exit: 0 bytes in 0 blocks
==4735==   total heap usage: 10 allocs, 10 frees, 216 bytes allocated
==4735==
==4735== All heap blocks were freed -- no leaks are possible
==4735==
==4735== For counts of detected and suppressed errors, rerun with: -v
==4735== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

1 个答案:

答案 0 :(得分:0)

y值应大于64,即。 20状态栏+ 44导航栏。 另外,您不需要drawText和frame tile。 只需添加

pageTitle.frame = CGRect(x: 20, y: 200, width: UIScreen.main.bounds.width - 20, height: 50)

会工作的。