本文介绍了在模式视图的父视图中访问IBOutlet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我有一个iOS应用,其体系结构为:

I have an iOS app where my architecture is:

VC1 => MVC1

我想访问VC1的IBOutlet(aboutBtn).我尝试在MVC1中创建一个委托并将VC1设置为委托,但仍然无法访问它.我该怎么办?

I want to access to an VC1's IBOutlet (aboutBtn). I tried making a delegate in MVC1 and setting VC1 as delegate, but I still can't access it. How would I do it?

推荐答案

我只是在MVC1中创建一个实例变量,然后将您要从VC1访问的IBOutlet变量传递给MVC1.例如,您可以从VC1调用类似MVC1.referenceToSomeIBOutlet = self.someIBOutlet的名称.这将使MVC1访问传入的IBOutlet对象.

I would just create an instance variable in MVC1 and pass the IBOutlet variable you're trying to access from VC1 to MVC1. For example, you could call something like MVC1.referenceToSomeIBOutlet = self.someIBOutlet from VC1. That will give MVC1 access to the passed in IBOutlet object.

这篇关于在模式视图的父视图中访问IBOutlet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 18:03