In general, we are in the two tableview between the transfer value is one-way, this method of transmission is irreversible.
First, if the value inside the Aview is passed to the bview inside the implementation method is as follows:
1.1 If you pass a single piece of data, define a string str in bview, which is used as a two-view
To accept a single piece of data.
nsstring* str;
1.2 If you are passing multiple data, you need to encapsulate the data inside the Aview, you need to define a class to encapsulate these
Data. Nsclassa* object.
Class Nsclassa
2 in Aview's Jump method, initialize the Bview object, which is used to accept the value of the past in the Aview.
bviewcontroller* BVC = [[Bviewcontroller alloc]init];bvc.str = [Label text];
3. When the control is initialized in the bview, the line is assigned the corresponding value.
[Pushtext SETTEXT:STR];
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/73/1C/wKioL1X1vyCQNqHpAABhYetvsXc977.jpg "title=" QQ picture 20150914021147.jpg "Width=" height= "254" border= "0" hspace= "0" vspace= "0" style= "width:300px;height:254px" alt= "Wkiol1x1vycqnqhpaabhyetvsxc977.jpg"/>650) this.width=650; src= http://s3.51cto.com/wyfs02/M01/73/1F/ Wkiom1x1vqejx-poaabs6vujqsi966.jpg "title=" b.jpg "width=" "height=" "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:300px;height:250px;float:right; "alt=" wkiom1x1vqejx-poaabs6vujqsi966.jpg "/>
Second, if we put the values inside the Aview view to the Bview,bview inside to change the value of the corresponding changes, feedback to Aview, here can not use the above that simple transfer value, here need to use the agent idea.
1. Implement a protocol within the bview, which has a SetValue method that will be used to pass the line operation.
@protocol passdelegate-(void) Setvalues: (NSString *) str;
2. Create the field delegete of the ID type, which is used to invoke the SetValue method.
id<passdelegate>delegate;
3. Use SetValue method to transmit value in bview;
[delegate setvalues:[pushtext text]];
4. Rewrite the Setvalues method in the Aview view
-(void) Setvalues: (nsstring*) str{[label setText] = str;}
In this way, a reverse value transfer process is implemented. 650) this.width=650; "src=" Http://img.baidu.com/hi/jx2/j_0028.gif "alt=" J_0028.gif "/>
This article is from the "Wodenianshao Technology blog" blog, make sure to keep this source http://wodenianshao.blog.51cto.com/10604330/1694434
Realization of mutual value between UITableView