How to have a new window after clicking a button

Discussion in 'Mac Programming' started by cs.iris, Feb 16, 2012.

  1. cs.iris, Feb 16, 2012
    Last edited: Feb 16, 2012

    macrumors newbie

    Joined:
    Jan 11, 2012
    #1
    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:eek:
     
  2. macrumors 68000

    Joined:
    Mar 29, 2009
    Location:
    USA
    #2
    What have you tried? It could be as simple as showing an Alert containing the desired text.
     
  3. cs.iris, Feb 16, 2012
    Last edited by a moderator: Feb 16, 2012

    thread starter macrumors newbie

    Joined:
    Jan 11, 2012
    #3
    actually I've used it already.
    I tried this code:
    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... :(
     

Share This Page