ios - Get viewController reference to shared code behind file -
i've started developing apps ios , have problem can't figure out atm.
my app contain 2 viewcontrollers, both of them have 1 label each , want code behind (one single file) same calculation 2 different numbers depending on viewcontroller shown.
for example: code behind should calculate 1 * x, x either 1 first view or 2 second view. (and print sum)
so, there anyway can reference of view i'm (the user) at? or have create 2 files code behind same code, 1 number different?
storyboard:
what want achieve in pseudo:
if viewcontroller == 1 label1.text = 1 else if viewcontroller == 2 label2.text = 2
thanks help
imo best option have 1 view controller (in storyboard too) , 2 views outlets , swap them (hide/show).
but can distinguish between views example tag property of uiview.
Comments
Post a Comment