iPhone SDK Programming - Working with a variable across 2 views
Posted
by SD
on Stack Overflow
See other posts from Stack Overflow
or by SD
Published on 2010-04-08T03:29:43Z
Indexed on
2010/04/08
3:33 UTC
Read the original article
Hit count: 195
I have what I hope is a fairly simple question about using the value from a variable across 2 views. I’m new to the iPhone SDK platform and the Model/View/Controller methodology. I’ve got background in VB.Net, some Php, but mostly SQL, so this is new ground for me.
I’m building an app that has 3 views. For simplicity’s sake, I’ll call them View1, View2, View3.
On View1 I have an NSString variable that I’ve declared in View1.h, and synthesized in View1.m. I’ll call it String1. View1.m uses a UITextField to ask the user for their name and then sets the value of String1 to that name (i.e. "Bill").
I would now like to use the value of String1 in View2. I'm not doing anything other than displaying the value ("Bill"), in a UILabel object in View2.
Can someone tell me what the easiest way to accomplish that is?
Many thanks in advance….
© Stack Overflow or respective owner