Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 02-18-2009, 04:42 PM   #2 (permalink)
markwilliams
New Member
 
Join Date: Feb 2009
Posts: 8
Thumbs up

Quote:
Originally Posted by JohnMabassa View Post
Hi
I have an application with a two text fields in one view(view1) and two labels in another view ( view2). I have a button in view1, when it is pressed it loads view2 and I want to change the label to the text that i entered in the text field. How can I do it?........... i have read somewhere in the forum about delegates and all, I read in details but I was not able to figure out how to use it.

Can anyone provide me a sample code?

Thanks in Advance
-John
I think you are invoking the second view (view2) in the following manner.

.h file of view1

#import <UIKit/UIKit.h>
#import "View2Controller.h"

@interface View1Controller : UIViewController {
View2Controller *view2;
}
@property (nonatomic,retain) View2Controller * view2;
@end

in .m file of view2

if(self.view2 ==nil) {
View2Controller *view2Controller = [[View2Controller alloc] initWithNibName:@"View2View" bundle:[NSBundle mainBundle]];
self. view2 = view2Controller;
[view2Controller release];
[self.navigationController pushViewController:self. view2 animated:YES];

In view2, create a property by name textValue andyou can set the text field value to this property just before the the last line of code.

for eg:
view2.textvalue=myTextField.text;
[self.navigationController pushViewController:self. view2 animated:YES];
markwilliams is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 158,697
Threads: 89,170
Posts: 380,434
Top Poster: BrianSlick (7,110)
Welcome to our newest member, jasonsusan705
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 08:38 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.