更新时间:2023-02-18 18:13:48
您不能在 prepareForSegue
中访问 DetailViewController
的 IBOutlet
s,因为它们是尚未连接.
You cannot access IBOutlet
s of DetailViewController
in prepareForSegue
because they are not connected yet.
正如评论中提到的,在 DetailViewController
中创建一个 String
属性,在 prepareForSegue
中设置它并设置 text
DetailViewController
的 viewDidLoad
或 viewWillAppear
中标签的属性.
As mentioned in the comments create a String
property in DetailViewController
, set it in prepareForSegue
and set the text
property of the label in viewDidLoad
or viewWillAppear
of DetailViewController
.