草庐IT

xcode - 无继承 socket

coder 2023-09-10 原文

我已经定义了一个具有 UITableView socket 的基类。

class BaseController: UIViewController, UITableViewDataSource, UITableViewDelegate  {


@IBOutlet weak var tableView: UITableView!
...

然后我继承了类如下:

class SubViewController: BaseController {

override func viewDidLoad() {
   tableView.rowHeight = screenHeigth / CGFloat(textArray.count)

但是 tableView 是 nil,我最近才开始用 swift 编程,是否可以继承一个 outlet?如果是这样,我应该怎么做?

我目前使用的是 Xcode 6.4

最佳答案

您可以继承 socket 。在您的 Storyboard(假设)中, View Controller 类名称应设置为您的子类 的名称。然后,您可以将 TableView 连接到 Storyboard 中的 socket 。

关于xcode - 无继承 socket ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32376438/

有关xcode - 无继承 socket的更多相关文章

  1. ruby-openid:执行发现时未设置@socket - 2

    我在使用omniauth/openid时遇到了一些麻烦。在尝试进行身份验证时,我在日志中发现了这一点:OpenID::FetchingError:Errorfetchinghttps://www.google.com/accounts/o8/.well-known/host-meta?hd=profiles.google.com%2Fmy_username:undefinedmethod`io'fornil:NilClass重要的是undefinedmethodio'fornil:NilClass来自openid/fetchers.rb,在下面的代码片段中:moduleNetclass

  2. ruby - 如何在 Lion 上安装 Xcode 4.6,需要用 RVM 升级 ruby - 2

    我实际上是在尝试使用RVM在我的OSX10.7.5上更新ruby,并在输入以下命令后:rvminstallruby我得到了以下回复:Searchingforbinaryrubies,thismighttakesometime.Checkingrequirementsforosx.Installingrequirementsforosx.Updatingsystem.......Errorrunning'requirements_osx_brew_update_systemruby-2.0.0-p247',pleaseread/Users/username/.rvm/log/138121

  3. ruby-on-rails - 如何使用 Xcode 4.5.1 在 OSX Lion 10.8.2 上编译 EventMachine gem - 2

    我找遍了所有我能找到的地方,但似乎找不到解决这个问题的办法。我在Lion10.8.2上使用Xcode4.5.1,并尝试为Rails项目运行bundle,但它一直卡在这上面。我正在为Heroku使用Thingem。Bolanos@Jeremys-Mac-mini⦿-1.9.3fishfarm$sudogeminstalleventmachinePassword:Buildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingeventmachine:ERROR:Failedtobuildgemnativeextens

  4. 已解决socket.timeout : The read operation timed out - 2

    已解决(pip安装模块超时,利用四种国内镜像源完美解决)WARENTING:Retrying(Retry(total=4,connect=None,read=None,redirect=None,status=None))afterconnectionbrokenby‘ConnectTimeoutError(pip._vendor.urllib3.connection.HTTPSConnectionobjectatOx00001D6OE4F4A940>,‘Connectiontopypi.orgtimedout.(connecttimeout=15)’)’':/simple/pip/socke

  5. ruby - Cucumber 测试无法启动,错误为 "Display socket is taken but lock file is missing.." - 2

    运行cucumber后bundleexeccucumberfeatures/emails.feature:20我遇到了错误Displaysocketistakenbutlockfileismissing-checktheHeadlesstroubleshootingguide(Headless::Exception)/Users/me/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/headless-2.2.0/lib/headless.rb:195:inensure_xvfb_is_running'/Users/me/.rbenv/ver

  6. ruby - Interface Builder 看不到 MacRuby 的 socket - 2

    我正在尝试使用XCode和InterfaceBuilder构建一个基本的helloworld应用程序。但是,在InterfaceBuilder中,我看不到我的socket可以连接起来。我转到对象检查器Pane的连接选项卡,它显示“NewReferencingOutlet”。我想知道我的代码是否有误。在这里classHelloWorldControllerattr_accessor:hello_label,:hello_button,:hellodefawakeFromNib@hello=trueenddefchangeLabel(sender)if@hello@hello_label.

  7. ruby - 开始使用 MacRuby 和 Xcode 4.2 - 2

    我最近想开始使用MacRuby。我已经安装了Xcode4.2和MacRuby,但显然我遗漏了一些东西。到目前为止,在我发现的每个教程中都说,我必须从Xcode模板中选择“MacRuby应用程序”……但是没有这样的条目可用。我试过0.10和几天前发布的每晚版本。我查看了MacRuby的安装位置,我找到了Xcode3.0的模板……我必须使用这些模板吗?如何将它们导入Xcode4.2?在开始之前,我还想知道,从MacRuby开始是否安全?乍一看,我认为"is",因为有新的MacRuby书籍可用——但MacRuby网站上似乎没有太多事件(去年3月的最后一篇博客文章?)……根据我的经验,这可能是

  8. ruby - 在 Xcode 运行脚本构建阶段使用 rvm 强制指定 Ruby - 2

    在Xcode之外,我使用特定版本的Ruby,使用RVM管理多个Ruby安装。Apple的命令行开发工具将Ruby安装在/usr/bin/ruby并且版本为1.8.7。我通过RVM使用1.9.3。有没有办法强制Xcode在运行其运行脚本构建阶段时使用我的1.9.3安装?我已经尝试将Shell路径设置为我的特定Ruby的完整路径,但这似乎没有什么不同,我的意思是我在1.9.3中安装的特定Gems不可用/在Xcode中运行时对脚本可见。如果我在命令行上通过xcodebuild运行我的项目,运行脚本阶段会使用我的特定Ruby,因为它是从我的shell环境中运行的(即使项目文件中的Shell路径

  9. ruby-on-rails - 是否有针对 Rails、Ruby、Erb 的 Xcode 语法着色?如果没有,我怎么能自己写一个? - 2

    Xcode的语法着色充其量只是很差,而textmate看起来不错,但我喜欢Xcode,因为我也用C++编程。我想将所有内容都放在一个地方并利用其他Xcode功能。有没有人已经这样做过或者有没有简单的方法来做到这一点? 最佳答案 你可以去Editor>SyntaxColoring>CheckHTMLanddoitagainforRuby 关于ruby-on-rails-是否有针对Rails、Ruby、Erb的Xcode语法着色?如果没有,我怎么能自己写一个?,我们在StackOverflo

  10. ruby - 使用 RVM 的 Mac OS X Lion Xcode 问题 - 2

    我的Xcode4.1预览版5运行良好,但我决定通过应用商店升级到最终版xcode4.1。我先卸载了Xcode...sudo/Developer/Library/uninstall-devtools–mode=all然后通过应用商店安装Xcode并重新启动。我还完全删除了RVM但是...现在每当我尝试安装Ruby版本时都会失败。在错误文件中我得到这个:[2011-07-2718:29:25]./configure--prefix="/Users/holden/.rvm/usr"checkingforaBSD-compatibleinstall.../usr/bin/install-cch

随机推荐