如何从mainVC.m访问customCell.m中的变量 [英] How to access variable in customCell.m from mainVC.m

查看:53
本文介绍了如何从mainVC.m访问customCell.m中的变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有按钮的自定义单元格。有没有办法可以在按钮操作方法中从mainVC.m访问变量到customCell.m?



我可以这样做:mainVC main = [[ mainVC alloc] init] ;,但是这会产生一个新的主文件。我需要访问原文。

I have a custom cell with a button inside. Is there a way I can access a variable from mainVC.m to customCell.m in the buttons action method?

I can do like this: mainVC main = [[mainVC alloc] init];, but that would make a new main file. I need to access the original.

推荐答案

是的。您必须将按钮操作连接到vc。在其中你有发件人,这是你的单元格。如果你正确施放。



如果你在界面构建器中构建按钮,你也可以将它连接到插座。



我的提示是,你学习了一些关于界面构建器的东西。请阅读 Ray Wenderlich教程并畅玩。

这对你有所帮助; - )
Yes. You must connect the button action to the vc. In it you have the sender, which is your cell. If you cast properly.

If you build the button in the interface builder you can also connect it to an outlet.

My tip is, that you learn some stuff about the interface builder. Please read the tutorial of Ray Wenderlich and play around.
It will help you more than asking ;-)


这篇关于如何从mainVC.m访问customCell.m中的变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆