Is it Possible to Scroll and Add objects to uiscrollview in INTERFACE BUILDER?

Discussion in 'iOS Development' started by whocaresit, Jul 24, 2009.

  1. whocaresit

    whocaresit New Member

    Joined:
    Mar 11, 2009
    Messages:
    48
    Likes Received:
    0
    Is it Possible to change the ContentSize in IB for a Scroll view. Then Scroll the
    ScrollView and add objects the way we want without having to do everything programatically by adding subview?
  2. bddckr

    bddckr Active Member

    Joined:
    Dec 2, 2007
    Messages:
    1,434
    Likes Received:
    18
    Device:
    iPhone 4 (Black)
    You can only change the Content Insets in IB:

    Please Register or Log in to view images


    Apple doesn't allow IB plugins (yet?), so no one will officially change this. But you can always request a feature via bugreporter.
  3. Chicken

    Chicken Retired Moderator

    Joined:
    Feb 17, 2008
    Messages:
    2,494
    Likes Received:
    7
    Device:
    iPhone 5S
    The bug reporter is for reporting bugs. I don't think Apple will be happy if you send them feature requests.
  4. gojohnnyboi

    gojohnnyboi Well-Known Member

    Joined:
    Jan 25, 2008
    Messages:
    3,339
    Likes Received:
    55
    There is no reason that this should be a 'feature'. If everything was accessible through interface builder, imagine the junk that would pop up on App Store?
  5. cocotutch

    cocotutch Community Development Team Staff Member

    Joined:
    Oct 6, 2008
    Messages:
    1,285
    Likes Received:
    117
    Device:
    5G iPod touch
    You can of course, add objects to a UIScrollView in Interface Builder, except you cannot scroll to them in Interface Builder out of the box yet. In Xcode, make an IBOutlet UIScrollView *scrollView in the H file and in the M, under "viewDidLoad" set "scrollView.contentSize = CGRectMake(LENGTHxWIDTH);"

    That will allow you to scroll in the iPhone Simulator and Device.
  6. bddckr

    bddckr Active Member

    Joined:
    Dec 2, 2007
    Messages:
    1,434
    Likes Received:
    18
    Device:
    iPhone 4 (Black)
    https://bugreport.apple.com/
    "Classification: Feature (New)"
    I completely agree. If you need to do this stuff than code. Programming is about coding. Not Drag 'n' Dropping.
  7. Chicken

    Chicken Retired Moderator

    Joined:
    Feb 17, 2008
    Messages:
    2,494
    Likes Received:
    7
    Device:
    iPhone 5S
    Umm wow, you got me there. A feature isn't a bug. :/ Goddamn you Apple. Make things clearer next time.
  8. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    I love Interface Builder. It's not about being lazy or anything like that. Instead, it makes creating the interface so much easier. Instead of compiling the code, inspecting the appearance, adjusting the layout a few pixels, and repeating ad nauseam, I prefer plopping things where they look decent and tweaking them while actually looking at a view. It saves a lot of time. Instead of taking a few minutes to code a basic interface, IB will only take a moment. This saves time for making productive code.

    No, Interface Builder is full of win. I'm not saying anyone in this thread, but te majority of the IB bashers are those that don't actually know how to use it.


    That said, I've never made a UIScrollView in IB. I'd imagine that you'd create a view as wide as you want, then set that as the contentView, or whatever. If IB won't let you set that property, then it's super easy to code. Just add the view (designed in IB) as the content. So like one line of code, presuming you set the content size somewhere.

    Scrolling in IB shouldn't be necessary. Also, your view should not he a subview of the UIScrollView anyway.
  9. NolesFans

    NolesFans New Member

    Joined:
    Sep 23, 2008
    Messages:
    404
    Likes Received:
    0
    Device:
    iPod touch
    As for me, I like manual instead let IB do automatic for me. I like to challenge myself so I can see what I am doing wrong or right. Programming supposed to be fun if you do it in manual. A program like IB is would ruin any kind of fun.
  10. Cyanidepoison

    Cyanidepoison Active Member

    Joined:
    Jan 18, 2008
    Messages:
    1,076
    Likes Received:
    2
    You'll get past that eventually.


    I use Interface Builder to make stuff and then I run nib2objc on it to generate code. Strip out the dead code, change the names, and I've gained a couple fractions of a second in speed.

    Ok that's not really why I do it, I like to be able to compile on Linux and OS X.

Share This Page