PDA

View Full Version : How to have a new window after clicking a button




cs.iris
Feb 16, 2012, 01:18 PM
Hello..
Do anyone of you knows how to make a new window appear after clicking a button?
I know this is a basic question but I can't seem to make it. I've done already the ones that can output what you type in the textfield, but the problem in my app is that I am using Label.

flow of the program:
After clicking the done button, I should view a new window to show the words(that is inside/generated by the solve button).And then, I can close the new window and get back to the app/original window.

After reading so many posts, I still don't know how to do this. Can someone please help me?:(
Thanks in advance :)

kinda urgent..pleassseee
--I am a newbie:o



robvas
Feb 16, 2012, 02:00 PM
What have you tried? It could be as simple as showing an Alert containing the desired text.

cs.iris
Feb 16, 2012, 02:21 PM
What have you tried? It could be as simple as showing an Alert containing the desired text.

actually I've used it already.
I tried this code:
(it will simply get the input word and then add it to the string Hello.. I've used this as a test)
-(IBAction)done:(id)sender{
NSString *str = [[NSString alloc] initWithFormat:@"Hello, %@", sol.text];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Hello!"
message:str delegate self
cancelButtonTitle:@"Done"
otherButtonTitles:nil];
[alert show];
[str release];
[alert release];
}
-(void)dealloc{
[sol release];
[super dealloc];
}

//.h
@interface Word:UIViewController{
IBOutlet UITextView *sol;
}
@property(nonatomic, retain)UITextView *sol;

-(IBAction)done:(id)sender;

--what do you think is my error???really need help... :(