问题描述
我有两个 viewcontrollers.->AViewController,BViewController
AViewController
需要创建一个 BViewController
对象.然后 presentmodalcontroller
:转到 BViewController
.
AViewController
need to create an object of BViewController
.And presentmodalcontroller
: to go to the BViewController
.
并且 BViewController
也需要创建一个 AViewController
的对象,以便可以在 BViewController的
方法内更新标签文本.
And BViewController
need to create an object of the AViewController
as well, so that is can update the label text inside BViewController
's
method.
已尝试导入 BViewController
中的 AViewController
中.错误出来.未知类型名称" ViewController
",您是说" UIViewController
"吗?
Has try import in AViewController
in BViewController
. error come out. unknown type name'ViewController
', did you mean 'UIViewController
'?
如果我也想访问AViewController,该如何解决.
If i want access the AViewController too, how do i solve this.
外面的任何人都可以帮助我,在此先谢谢您.
Anyone out there can help me, thank you in advance.
推荐答案
在您的BViewController.h
In your BViewController.h
#import AViewcontroller.h
@property(nonatomic,retain) AViewcontroller* aViewcontroller;
在您的BViewController.m
In your BViewController.m
@synthesis aViewcontroller;
然后在AViewcontroller.m中创建BViewcontroller对象的地方,说bViewcontroller
Then in your AViewcontroller.m where you create your BViewcontroller object lets say bViewcontroller
bViewcontroller.aViewcontroller=self;
//then navigate to bViewcontroller
然后,您可以在BViewController的方法中更新以前的AViewController的标签文本.
Then you can update the previous AViewController's label text inside BViewController 's method.
self.aViewcontroller.label_you_want_to_update.text=@"your_text_here";
希望这会有所帮助
这篇关于访问另一类中的标签文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!