How to open new .xib on UIButton click

Discussion in 'iOS Programming' started by webznz, Mar 22, 2011.

  1. webznz macrumors member

    Joined:
    Mar 8, 2011
    Location:
    Hobbitin
    #1
    Hi there, I am just wondering what the code is to open a new window on the click of a UIButton?
     
  2. primedime macrumors member

    Joined:
    Mar 21, 2011
    Location:
    Ft. Lauderdale, FL
    #2
    Do you mean you want to have buttons that when pressed take you to a new view?

    What is the structure of your app? Will you have a Navigation Bar in oder to get back to the original view?
     
  3. webznz thread starter macrumors member

    Joined:
    Mar 8, 2011
    Location:
    Hobbitin
    #3
    Hi there, sorry for the lack of information. Sometimes I should just slap myself and get it over with.

    Okay so I have a really basic application at the moment that has a tabbar controller, with a couple of entries on it. search and settings each view has a navigation bar on it as I am going to use this to edit a tableview etc, but can also use it for navigation (I think :) )

    search is going to be used to search for an item from a button press and it is the main view for the search tabbar button, I was hoping to load a new window that would have a table view of a list of possible matches to the query that the user could then click to go into say the detail under the same tabbar button.

    So what I was hoping for is some direction, possible code example of how to load a new view with a button click under the same tabbar button view? if that makes sense. If you have any questions just ask, I have been doing research on this but I just dont seem to know what to actually look up.. as I'm still fairly new to iOS development.
     
  4. jnoxx macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #4
    This is serious basic stuff, u should grab a book and read through those, because, asking everything on a forum, and waiting for people to respond, will turn onto u eventually.
    The thing is, do u just wonna show u something, or wonna do something with it.
    U could just push a controller via a NavigationController, or just add a view, never call them windows, because an app only has one, via the appdelegate.
    then use the
    [self addSubview:whateveruwantview];

    could be an UIImage, or another view. But the problem is, u don't know the basics. SO u need to learn those.
     
  5. webznz thread starter macrumors member

    Joined:
    Mar 8, 2011
    Location:
    Hobbitin
    #5
    Sorry but I don't really understand any of what you said, not because I'm new to Objective-C or anything... just because of the way you structured your sentence and spelt your words.

    I have been reading many books, Mostly stuff about memory management and the likes. It might seem like an easy question but what I am worried about is the fact my current view controller is the TabBar. So If I offer a new way of navigating to the user with a button what sort of things do I need to think about to make sure that my application will not fail.

    One last thing, everyone has to start from some point right? why try and put people down about what they do or don't know without knowing anything about them? It will only scare people away from this forum, which is not a good thing IMO.
     
  6. primedime macrumors member

    Joined:
    Mar 21, 2011
    Location:
    Ft. Lauderdale, FL
    #6
    If you already have 2 views set up with a tab bar and a navigation bar, just set up one more view that when a button is pushed it takes you to that view. As long as you wrap all the views with a navigation bar it should create the back button automatically for you. From what you have said you have almost all of this done expect you haven't added a new view, or detail view some might call it.
     
  7. webznz thread starter macrumors member

    Joined:
    Mar 8, 2011
    Location:
    Hobbitin
    #7
    Ohh yep I get you, thanks for the help :)

    For some reason It's always the simple things that trip me up the most!. :eek:
     
  8. balamw Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #8
    If you don't want that attitude you need to give more than you did to get the help you seek. Tell us more about what your background is, what resources you are using, where you are going with this, ...

    You admit in your first reply that you didn't provide a lot of information. These two resources are (IMHO) very useful to read before you ask a question on a programming forum that can help you format a question in a way that will be more effective and also be more likely not to be met with attitude.

    http://www.mikeash.com/getting_answers.html
    http://whathaveyoutried.com

    Don't ask open questions or withhold pertinent information, provide code where possible, say what you expect, what you got instead, give an example of another app that does what you want, ...

    B
     
  9. webznz thread starter macrumors member

    Joined:
    Mar 8, 2011
    Location:
    Hobbitin
    #9
    .... Your post really pissed me off, not because you were rude or anything but because in my attempt to not become this person that your two links describe, I have in-fact become that person... And that made me really mad.

    Thank you for the mirror, I have read both sites you referenced and will now use that knowledge to hopefully avoid every becoming that person again.

    :(
     
  10. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #10
    And when you say you're reading a book, tell us the exact title and author. Also tell us what chapter you're on, and whether the question you're asking is something from the book or not. Accuracy matters.

    It's not uncommon for newbies to think they can tackle something not yet covered by a book, and grossly underestimate the complexity of what they're trying to do. That, too, is part of the learning process, which is why it's important to say whether the task in question is from the book. Most books won't present exercises that are beyond the skills a reader has gained to that point. If it's something you've decided to do on your own, recognize it's a task that's created and assigned by someone with essentially no experience in building software or estimating its complexity.
     
  11. balamw Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #11
    Which is why knowing what books (or other resources) you have handy is very important. It allows others that may be familiar with the material to say "keep reading, this will be covered in chapter XXX" or "go back and review chapter XXX" or suggest other resources.

    B
     
  12. webznz thread starter macrumors member

    Joined:
    Mar 8, 2011
    Location:
    Hobbitin

Share This Page