My first app, i need help

Discussion in 'iOS Programming' started by emf0401, Dec 14, 2011.

  1. emf0401 macrumors newbie

    Joined:
    Dec 14, 2011
    #1
    Hi, I started programming with xcode one month ago, and I'm making my first app and I have some problems...

    In my app I'm using a tab bar, scroll view,images, and a couple more things.

    If I want to use the tab bar do I have to make a tab bar application? because when if i do it then when I try to use the scroll view, for example, it doesn't work. Or could I use a view-based application? I also tried that and when I use the simulator it doesn't show the tab bar.

    Sorry if it is something stupid, but i'm new in all this and I try searching in google but i didn't find anything. Also sorry for my english I'm spanish :)
    Thanks, Emilio.
     
  2. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    Tab-bar application should be fine. What do you mean the scroll-view "doesn't work"?
     
  3. admanimal macrumors 68040

    Joined:
    Apr 22, 2005
    #3
    The templates are only helpful starting points. You can use any feature you'd like regardless of which template you start with.
     
  4. jnoxx macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #4
    Double that.
    Scrollviews only work if you set its contentsize larger then the size you putted it in the interface builder ;) just some things you should remember!
    About the tabbar, you can start any application with blank, and just add what you want, it's a matter of learning how to do it, they provide you with some basics, to get started faster, in other words, whatever floats your boat.
     
  5. emf0401 thread starter macrumors newbie

    Joined:
    Dec 14, 2011
    #5
    I also tried adding the code, and when I run the app with the simulator there's no scroll view. I learnt how to write the code for view based applecation, so I don't know if the code there is different.
    Thank you for the answers
     
  6. jnoxx macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #6
    there's no scroll view, how do you know, what did you try, how did you try to debug to what's going on. so many unanswered questions ;)
     
  7. emf0401 thread starter macrumors newbie

    Joined:
    Dec 14, 2011
    #7
    Okay, sorry but i'm new and I don't know a lot of thing.
    I'm right now in school so I will try to answer everything later. :)
     
  8. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #8
  9. larswik macrumors 68000

    Joined:
    Sep 8, 2006
    #9
    If you are totally new to programming like I was 18 months ago. I recommend that you first learn to program and understand it. If you get totally lost making an app and you are searching for that youtube video to give you the parts you need, you are not learning. Programming is hard and takes time. So if you struggle start with the basics first like I did. I spent over a year before I made my first GUI

    http://www.amazon.com/Learn-C-Mac-Dave-Mark/dp/1430218096
     
  10. balamw Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #10
    Besides what larswik and demo have already said, it would help us to know something about your background. What programming (if any) did you do before starting with Xcode last month?

    B
     
  11. emf0401 thread starter macrumors newbie

    Joined:
    Dec 14, 2011
    #11
    I know a little bit of html and php and also I read this book.
    http://img2.imagesbn.com/images/103180000/103189658.jpg

    ----------

    Okay so I did the scroll view like I did in a View based application.
    I type in the controller.h

    Code:
    @interface FirstViewController : UIViewController{
    
    
        UIScrollView *scroller;
    }
    
    @property (nonatomic, retain) IBOutlet UIScrollView *scroller;
    And in the controller.m

    Code:
    @synthesize scroller;
    
    - (void)viewDidLoad
    {
        [scroller setScrollEnabled:YES];
        [scroller setContentSize:CGSizeMake(320, 1000)];
        [super viewDidLoad];
    }

    And it worked in view based. The thing is that I don't know if I have to put it different when I'm using a tab bar application.
    Then I don't know how to debug...
     
  12. jnoxx macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #12
    Your UIScrollView is never set, and since it's not an IBoutlet, you will need to code it first, it doesn't know where to set it's frame, what pointer instance it is. etc..
     
  13. emf0401 thread starter macrumors newbie

    Joined:
    Dec 14, 2011
    #13
    So what do I have to do? And was it working in the view based application?
     
  14. jnoxx macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #14
    YOu can make a ScrollView anytime ;)
    You need to alloc init your scrollview, with a frame, so it knows where to actually set it to your screen.
    OR you make it an IBOutlet and put it in the XIB..
    If you have no idea what i'm talking about, maybe check some iphone tutorials on how to program for iPhone.
     
  15. emf0401 thread starter macrumors newbie

    Joined:
    Dec 14, 2011
    #15
    But I did making the IBOutlet right? I don't understand the first way, could you explain it to me?;)
     
  16. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #16
    No. You reserved space for a variable that holds a pointer to a UIScrollView. This does not create an instance. I think you need to take about 10 steps back and learn the fundamentals of C (yes C, not Objective-C).
     
  17. jnoxx macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #17
    Like Robbie said, but he can explain it better then me, you have a property and an ivar, there is a difference, and you should definitly take a step back, and actually know what your jotting down in code, or you will bump your head alot more then you intend to ;)
     
  18. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #18
    emf0401 , are you saying you created a view-based app, added the ivar and property for a UIScrollView and suddenly it appeared in your app? If so, I would love to see how you performed this miracle. Can you zip up your project and attach it to a post?
     
  19. emf0401 thread starter macrumors newbie

    Joined:
    Dec 14, 2011
    #19
    Okay that's what I did in the view based app that i said before.
     

    Attached Files:

  20. dejo, Dec 16, 2011
    Last edited: Dec 16, 2011

    dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #20
    I guess you forgot the part where you dragged a Scroll View into scrollerViewController.xib, since there is one in there and it wasn't automatic. So, you just do the same in whatever viewController.xib you want it to be in for your tabbed application.
     
  21. emf0401 thread starter macrumors newbie

    Joined:
    Dec 14, 2011
    #21
    Oh sorry I forgot that :confused: but the thing is that I couldn't drag it from the nib file in the tab bar app.
    do I have to create two controller.h and .m files for each tab?
     
  22. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #22
    How did you create your tab-bar application? Using the Tabbed Application template?
     
  23. emf0401 thread starter macrumors newbie

    Joined:
    Dec 14, 2011
    #23
    Yes, with the template
     
  24. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #24
    Is your project storyboarded?

    Better yet, instead of all the back and forth, I think you should just explain all the steps and settings you used to create your tabbed application.
     
  25. emf0401 thread starter macrumors newbie

    Joined:
    Dec 14, 2011
    #25
    Okay so it is not storyboarded, I just started a tab bar app template.

    But anyway I just started a new one to try again and it worked, I must did something wrong. So thank you very much!

    But I still having the questions about creating the files for each tab.
     

Share This Page