How to link the app menu items to something?

Discussion in 'Mac Programming' started by Technologx, Feb 18, 2016.

  1. Technologx macrumors member

    Technologx

    Joined:
    Dec 17, 2014
    Location:
    USA
    #1
    I want to link the menu items to either my forum or a html document that or another view screen with info on it but I have no idea how to do that. I included a screenshot of what I want to work on.

    Screen Shot 2016-02-18 at 7.07.36 PM.png
     
  2. mfram macrumors 65816

    Joined:
    Jan 23, 2010
    Location:
    San Diego, CA USA
    #2
    The standard paradigm for Mac Apps is to link menu items to Actions in either the Application Delegate object or, more likely, a Controller object. Then the Controller would perform the tasks needed to create new Views and Views Controllers as necessary. A forum post is not the best place to explain the details of all these concepts. You should be looking for Mac App tutorials in either books or on the web.
     
  3. Technologx thread starter macrumors member

    Technologx

    Joined:
    Dec 17, 2014
    Location:
    USA
    #3
    Alright well how do I link a menu item to another view xib?
     
  4. mfram macrumors 65816

    Joined:
    Jan 23, 2010
    Location:
    San Diego, CA USA
    #4
    I have written apps that do this in a number of ways.

    In one app (a game), I used a single XIB which included the main game window and a high score window. The high score window would be hidden by default (set using the attributes for the window in the UI builder). Also, in the XIB, I instantiated a separate controller object for the high score window. When the user selected the "Show High Scores" option in the menu, that action would link to a method in the the high score window controller.

    Code:
    - (IBAction) doShowHighScores:(id)sender;
    {
      [hsWindow makeKeyAndOrderFront:sender];
    
      hsData = [scores_manager getHighScores:nil];
      //NSLog(@"Fetch got %lu items", [hsData count]);
      [hsTable reloadData];
    }
    
    In this case, hsWindow is a IBOutlet to the High Score window. This design was easiest because there would only ever be one high score window. Just put everything in a single XIB.

    This might make the most sense in your case if you want to present a single web view that shows the contents of an HTML document.

    In another app, I wanted the ability to create multiple independent timer windows (think countdowns) on-the-fly. The user was allowed to keep creating new ones on demand. In that case, I created a separate XIB in my project which contained the timer window (text view with the time value, buttons to start and stop the timer, etc) and a controller object that would control that window. In the main program controller, I used the NSNib class to instantiate new copies of the objects (Window and Controller) in that "SubtimerWindow" XIB.

    Code:
    - (IBAction)makeNewTimer:(id)sender 
    {
      NSNib *nnib = [[NSNib alloc] initWithNibNamed:@"SubtimerWindow" bundle:nil];
      NSArray *topLevelObjects;
      BOOL result;
    
      result = [nnib instantiateNibWithOwner:self topLevelObjects:&topLevelObjects];
      if (result)
      {
      [subTimerList addObject:topLevelObjects];
      }
    }
    
    Creating objects in a XIB is the same allocating objects in code. Interface Builder can make it more convenient to create things with graphical elements. But Interface Builder can also instantiate other objects like controllers. You use IBOutlets to reference those things IB creates.
     
  5. Technologx thread starter macrumors member

    Technologx

    Joined:
    Dec 17, 2014
    Location:
    USA
    #5
    So how would I go about doing this when I want to link the About HiddenFileRemover menu item to a different view xib or storyboard?
     
  6. Technologx thread starter macrumors member

    Technologx

    Joined:
    Dec 17, 2014
    Location:
    USA
    #6
    Sorry I'm a complete noob when it comes to doing this.
     
  7. Technologx thread starter macrumors member

    Technologx

    Joined:
    Dec 17, 2014
    Location:
    USA
    #7
    This is what I'm wanting to do so everyone who reads this doesn't get confused.

    Screen Shot 2016-02-19 at 10.50.16 PM.png

    Screen Shot 2016-02-19 at 10.50.25 PM.png
     
  8. dryjoy macrumors regular

    Joined:
    Mar 19, 2009
    #8
    I'd seriously suggest you read something like this:

    http://www.apress.com/9781430245421

    All of the responses you have to your questions will fall into place after that. I think you are asking for too much from a simple forum thread.
     
  9. superscape macrumors 6502a

    superscape

    Joined:
    Feb 12, 2008
    Location:
    East Riding of Yorkshire, UK
    #9
    Absolutely agree.

    No offence intended, but you should probably think about working through some basic tutorials before diving straight into creating an app. There are plenty of good, free sources. If you look at iTunesU then there are some Stanford courses available for free, also raywenderlich.com has some basic beginner's guides. Maybe start here: http://www.raywenderlich.com/category/os-x
     
  10. Technologx thread starter macrumors member

    Technologx

    Joined:
    Dec 17, 2014
    Location:
    USA
    #10
    I don't have money for that crap
    --- Post Merged, Feb 29, 2016 ---
    I don't want to do that crap I want to create this sample app so I can create the app for my forum http://technologx.96.lt
     
  11. superscape macrumors 6502a

    superscape

    Joined:
    Feb 12, 2008
    Location:
    East Riding of Yorkshire, UK
    #11
    A very interesting attitude.

    mfram answered your specific question, and dryjoy and I recommended some more general tutorials to help you since you're clearly lacking some of the basic skills needed to create an app. If you don't have those skills already, and you're not willing to take the steps necessary to get them (regarding them as 'crap') then you may struggle. If that's the case then maybe you'd be better off hiring someone who already has those skills to create your app for you?
     
  12. aly macrumors member

    Joined:
    Jul 3, 2006
    Location:
    Scotland
    #12
    I think you mean create your 'crap' for you.
     
  13. Technologx thread starter macrumors member

    Technologx

    Joined:
    Dec 17, 2014
    Location:
    USA
    #13
    I'm not trying to be rude I'd just like to know how to do it.
     
  14. bjet767 macrumors 6502a

    Joined:
    Oct 2, 2010
    #14
    Dude

    Many programmers have spent decades learning their trade and during those years invested $$ in books, online training and polite forum exchanges. You seem to want someone to do your work for you at no cost.

    Hey, maybe you can find an answer on YouTube.
     
  15. Technologx thread starter macrumors member

    Technologx

    Joined:
    Dec 17, 2014
    Location:
    USA
    #15
    I'm not wanting anyone to do my work for me all I want to know is what I need to do to link those 2 elements.
     
  16. bjet767 macrumors 6502a

    Joined:
    Oct 2, 2010
    #16
    There's an outfit called "The Big Nerd Ranch" who has a multitude of books and tutorials on the subjects you desire. I also looked up your website and failed to see any references to apps or other things you mention here and on other threads. I did notice you seems to be a gamer and I wonder about some of your questions being more about hacking someone's system than developing an app.

    Frankly you make me a bit suspicious.

    Good luck on whatever you are doing.
     
  17. Technologx thread starter macrumors member

    Technologx

    Joined:
    Dec 17, 2014
    Location:
    USA
    #17
    I have no idea how to hack anything and my forum/site isn't for gaming it's a support/learning forum the site address is http://technologx.co.nf/tech91 .
     
  18. bjet767 macrumors 6502a

    Joined:
    Oct 2, 2010
    #18
    Ok whatever you say, but this website/Facebook uses same avatar as you have here.

    https://www.facebook.com/Technologx2013

    This is a quote from the url you gave us:

    "
    Technologx is a place for people to come and learn. It's also a place for others to help each other. Our goal is to be the friendliest community we can be and the only way to do that is with your help.
    "

    So how come you don't follow your own advice and come here in a kind of demanding way?

    I guess it is what it is.
     
  19. Technologx thread starter macrumors member

    Technologx

    Joined:
    Dec 17, 2014
    Location:
    USA
    #19
    I am trying to be kind man all I ask is how to do one thing that a lot of Mac app developers should know how to do but it don't seem like anyone knows how to do it or can point me to a guide that shows you how to do it. So don't quote my stuff to me man I don't like that.
     
  20. bjet767 macrumors 6502a

    Joined:
    Oct 2, 2010
    #20
    Ok and after reading the desires of your app to "remove hidden system files" I also understand you don't really understand the "sandbox" concept of an OS X app.

    The linking part is explained in the links people have sent you. So do it.
     
  21. jaduff46 macrumors regular

    jaduff46

    Joined:
    Mar 3, 2010
    Location:
    Northern NJ
    #21
    Agree with the obviously experienced developers above, especially the sandbox thought. This is not a one-off question with a quick response.

    Mfram gave you the framework for it, quite a bit of code and thought as a gift! If you don't understand it you should invest the $$ and time in one of the suggested websites to develop the skills and knowledge base you need.

    You should be very cautious in dealing with hidden files. Had an inexperienced UNIX consultant in one of my early jobs who came close to turning the minicomputer into a piece of iron by attempting to recursively eliminate files in subdirectories with zero length to clean up things (the 30 terminal connections included).
     
  22. zeppenwolf macrumors regular

    zeppenwolf

    Joined:
    Nov 17, 2009
    #22
    2016, Planet Earth... these are strange times.
     
  23. Technologx thread starter macrumors member

    Technologx

    Joined:
    Dec 17, 2014
    Location:
    USA
  24. jaduff46 macrumors regular

    jaduff46

    Joined:
    Mar 3, 2010
    Location:
    Northern NJ
    #24
    Consider the thought that the "hidden files" you want to remove may be exactly what makes the device mountable and readable?! Your actions may turn the device into the very piece of iron I alluded to earlier.

    Hence the sandbox idea where if you screw up you cant really do much harm to yourself while you're developing something new.

    Don't you guys actually have development and production servers for the same reason?

    Out of here!
     
  25. bjet767 macrumors 6502a

    Joined:
    Oct 2, 2010
    #25
    This person's website link is nothing but an advertisement and links to other sites. They even ask for a paid membership.

    Not to be trusted, run!
     

Share This Page