iPhone - scrollview with a textview and tableview inside - iphone

I have an interface which will have a text view and a table view below it. My current view looks like this
UIScrollView
UITextView
UITableView
Currently the TextView and TableView can scroll vertically..but what i want is the whole screen to scroll up/down. Why doesn't this work properly?

You can put a TableView inside a ScrollView, but you must resolve conflicts between touches, scrolling, and bouncing in IB or with code, and you must set the ScrollView's contentSize with code, not in IB.
If the TextView really "belongs" to the table, consider putting it in a table cell, or better, as a header, that's what they're for.

Related

iPhone: Make UIScrollView from UIView

I have a UIView with labels and textfields and I tested it in the simulator and noticed that I cannot scroll to see the rest of the view, how can I make the view into a UIScrollView and what do I need to do so I can make the view scrollable? I don't want to move labels and stuff or delete the UIView, is there a simple way?
Take a UIScrollView in Xib file outside your view. drag your view into this scrollview. The subviews inside your view remains same. and set the scrollview's contentSize

Making a Title scroll in a UIScrollView with the text below

I have a storyboard with a UIScrollView taking up the entire iPhone screen. I have a label at the top for the title, and then a textview below that which has text loaded into it from a .txt file. However when I scroll, it scrolls through the large body of text with the title staying put at the top of the view, even though the label is based in the scrollview rather than outside of it. Any ideas how I can fix this?
Thanks!
textView has its own scrolling method built in, so your textView will scroll independently of your scrollView. Create the title within the textView or set text view not to scroll in Interface builder and use your scrollView

Reminders.app UIScrollView scrolling explanation.

I am currently programming an application for the iPhone and I am having some issues with my horizontal (horizontal as in you scroll horizontally, not vertically) UIScrollView.
The UIScrollView's height is 260 and the width is 320. It has 2 pages and each page has a UITableView in it. The UITableView's frame is the same as the UIScrollView's frame.
The problem is that 80% of the time, the current UITableView detects the drag/swipe as a vertical scroll (but it's actually horizontal) and begins to scroll the table view vertically.
My question is the following:
Can somebody explain to me how the app Reminders does for the scrollview scrolling. If you look carefully, you can see that the scrollview handles the horizontal scrolling very well and that a horizontal scroll is handled by the scrollview (and not by the tableview like mine does). If anyone needs more explanation please leave a comment.
If I try to scroll to the left/right in the table view of Reminders, it doesn't respond to it. If I scroll in the table header view where the add button is, it scrolls without any problems. My guess is that they made the table view header a UIScrollView. Apple highly discourages the use of a table view in a scroll view (or any view that inherits from UIScrollView into a different view that inherits from UIScrollView, for that matter), so they probably wouldn't take their own advice and ignore it.

UIScrollView inside UITableView

i got a tableview and as a header i use amongst other things a scrollview.
All work ok in terms of scrolling apart from the fact that when i scroll down (or up) the tableview the scrollview "loses" the x,y coordinates.
for example if i scroll the scrollview on the headerview right to left (or vice versa) then the scrollOffset.x gets a value.
if i start scrolling the tableview then this value goes back to zero (although the scrollview doesnt lose the paging). If i go back to the scrollview and start scrolling again the scrollOffset.x gets its correct value again.
Anyway to "keep" the scrollOffset.x value when i scroll the tableview?
thanks
Considering that a tableView is a scrollView subclassed it seems like the problem is that scrollOffset.x is set by whichever scrollView you're currently scrolling inside of. Try adding tags to your table view and scroll view and add a variable to keep up with the scrollOffset.x for only the scrollView in your header.

Prevent subview from scrolling in a UIScrollView

I have a UIScrollView subclass with a certain subview I'd like to prevent from scrolling (while all the other subviews scroll as normal).
The closest example to this I can think of is UITableView's "index strip" on the right side (look in the Contacts app to see an example). I am guessing this is a subview of the table (scrollview) but it does not move as the user scrolls.
I can't seem to make my subview stay put! How can I accomplish this?
The trick is to adjust the frame of the "non-scrollable" subview inside -layoutSubviews.
Add the view that you want not to move as a sibling view of the scroll view on top of the scroll view instead of as a subview.
You can set it's property called userInteractionEnabled to NO