How to add a new window in a view based app?

Discussion in 'iOS Programming' started by imakegoodapps, Mar 19, 2011.

  1. imakegoodapps macrumors newbie

    Joined:
    Mar 19, 2011
    #1
    Hello,

    I am new to xcode and would just like to ask the question "How to add a new window in a view based app?" Any help is appreciated,

    Thank you very much
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    In general you don't. iPhone applications tend to only have one UIWindow. Normally if you want to change what's on screen you either push a view controller onto a navigation stack (UINavigationController), use modal views (UIViewController presentModal) or simply replace the root view in the single UIWindow instance.
     
  3. imakegoodapps thread starter macrumors newbie

    Joined:
    Mar 19, 2011
    #3

    Alright, so could you tell me how to play a video in a tab bar app? Thanks! :D
     
  4. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    What have you tried? What documentation have you read? What have you searched for in Google?

    I don't believe in spoon-feeding people answers. The best way to help you is to ensure that you are able to help yourself, that you understand what you are doing and can solve your problems yourself going forward.
     
  5. imakegoodapps thread starter macrumors newbie

    Joined:
    Mar 19, 2011
    #5
    I have been going fowward for about 45 minutes looking for some silly code (well, not silly) Google doesnt always work ya know ::) Please help
     
  6. hayesk macrumors 65816

    Joined:
    May 20, 2003
    #6
    If you were making a custom alert view or sheet, consider adding a view to the existing window. For playing video, there's plenty of Apple documentation on how to do this. Read this first and look at Apple's sample code.
     
  7. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #7
    If you are looking for code then this is where I drop out. I don't give people code. I don't point people towards code. Copy and pasting code teaches you nothing and is not programming. Look in the documentation. Find some likely classes that might help. Experiment with them.
     
  8. imakegoodapps thread starter macrumors newbie

    Joined:
    Mar 19, 2011
    #8
    I am a newbie that doesnt know .m from .h ! But, thanks anyways!
     
  9. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #9
    And you'll stay that way for ever more if all you do is copy and paste.
     
  10. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #10
    Look up MPMoviePlayerViewController and MPMoviePlayerController.
     
  11. imakegoodapps thread starter macrumors newbie

    Joined:
    Mar 19, 2011
    #11
    Aint that a bit harsh, and sense I am obviously going nowhere with you, do you have any good books I can read to learn?

    Thank you!
     
  12. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #12
    There is a sticky thread at the top of this forum (FAQ) with lots of links to learning resources. I can't personally recommend a book: I taught myself Cocoa in the OSX public beta back in 2000...
     
  13. hayesk macrumors 65816

    Joined:
    May 20, 2003
    #13
    Did you even read the very documentation included with XCode? Did you notice that a lost of class references have a "Sample Code" section near the top. Apple includes lots of sample code to play video. It's right there on your Mac and is references from MPMoviePlayerViewController and MPMoviePlayerController.

    I know some of us are being harsh, but it seems like your method of programming is: "start coding, run to the forum when I get stuck, code some more, run to the forum when I get stuck, code some more, ..." It shouldn't have taken one of us here to tell you to read the docs for MPMoviePlayerViewController. You should have been able to find that yourself, if you read Apple's docs. We're not saying you have to read each class reference page, but Apple has guides for playing movies, using view controllers, tables, etc. You should be reading those.

    Stop programming for a while, and read Apple's documentation. If you had done that, your app would be playing video already. If you want a good book, get Aaron Hillegass' book.
     
  14. admanimal macrumors 68040

    Joined:
    Apr 22, 2005
    #14
    It's almost as if programming is an actual skill that some people spend years in school and/or practice to learn. Who would have guessed that not everything is learnable in 45 minutes of googling. Crazy!
     
  15. KnightWRX macrumors Pentium

    KnightWRX

    Joined:
    Jan 28, 2009
    Location:
    Quebec, Canada
    #15
    Then maybe you should start learning that before going into movie playing. The basics might be boring, but the basics are what makes everything work together to form an application.

    Go to the top of the forum, pick up a book on Objective-C. Learn about control structures, conditional statements, loops, variable types, memory allocation, pointers. Write code using the ANSI C library and output to the terminal.

    Then move on to Object Oriented programming, classes, subclassing, inheritance, public/private members, properties, getters/setters, virtual classes, template classes. Again, don't leave the terminal, none of this stuff requires a GUI.

    When you are done mastering this stuff (which should take you a few weeks to a few months depending on how fast a learner you are), move on to GUIs. Learn about event based programming, GUI types, GUI controls, MVC concepts. Write GUI code using Cocoa on OS X. Get an app going that way, ideally something simple like an address book or something that will make use of everything you've learned.

    After you're done (we should be about a year into learning programming now, self taught), jump to the iPhone app and write that video player you wanted to write initially.

    People spend years in college learning this stuff. It's not something you can pick up from Googling for 45 minutes.
     
  16. xStep macrumors 68000

    Joined:
    Jan 28, 2003
    Location:
    Less lost in L.A.
    #16
    imakegoodapps, you may think people are being harsh but they aren't. The cold reality is that you have to build your programming knowledge from a good foundation. Just jumping in at the 10th floor isn't advisable especially with large framework systems such as Cocoa or Cocoa Touch. Even people with many years of experience will go through this learning curve on systems new to them.

    The knowledge you have displayed here does suggest you should start with a good book. If you can't afford a book, check your local library. There have been many many many discussions here on how to get started. Read some of them for good suggestions.

    As for your search, Google will give you back good leads if you know what to search for. Getting familiar with Apple's documentation will help that process in the future because you'll become familiar with the nomenclature.

    A good start might be the free Objective-C Programming Language pages at Apple. It assumes you have some prior experience with C.

    As for what movies on an iOS device that you can playback, I believe you are limited to the ones in the Camera Roll or in your apps local folder structure.

    Speaking of foundations, another iOS class to look into for playing video would be AVFoundation.
     
  17. xStep macrumors 68000

    Joined:
    Jan 28, 2003
    Location:
    Less lost in L.A.

Share This Page