简体   繁体   English

我如何在Swift Xcode中初始化此类实例

[英]How do l initialize this class instance in Swift Xcode

在此处输入图片说明

myTVcontroller is a tableview controller, l want to create this instance in my custom cell to aid with my custom delegation to update a UILabel eg myTVcontroller是一个表视图控制器,我想在我的自定义单元中创建此实例,以帮助我的自定义委托更新UILabel,例如

instance.delegate = yes instance.delegate =是

But l don't know how and what to put inside the brackets, can you show me a sample please. 但是我不知道如何以及在括号内放什么,请给我一个样品。

Init with coder is used when you create instance of UIView (or subclass like table view) from xib/storyboard and this init with coder mostly is override in subclass to do some custom initialisation. 从xib / storyboard创建UIView实例(或类似于表视图的子类)的实例时,使用带编码器的初始化,并且带编码器的初始化在子类中被重写以进行一些自定义初始化。

If you want to create table view controller in code use init with style: 如果要在代码中创建表视图控制器,请使用带有样式的init:

myTVController(style: UITableViewStyle.Plain)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM