Using a UIPanGesture to drag a tableView/scrollView - objective-c

I suppose the best way to describe the control, that I'm trying to make, is a tableView that could be dragged left and right and then scrolled up and down. There's no tabs, or anything else that the user touches just table view and it's cells.
I've read the documentation on UIScrollView and UITableView and there wasn't much in there :( Then again there might have been stuff I've missed
Any help would be greatly appreciated.

Have you tried adding the UITableView as a sub view of a UIScrollView (which can scroll only in horizontal direction) ? Take a look at https://github.com/raweng/StackScrollView

Related

Simple wipe animation for image view

I've scoured the internet and I cannot seem to find any help on this. I want to have an image perform a wipe animation. By that I mean I would like the image itself to fade in from the left to right (not move from left to right, but fade, like reveal itself. I hope that's not a terrible description) I've found material on how to transition the image with a wipe, but it's outdated and I don't want to transition the image, I want to straight up fade it in. If anybody could help me on this I would be incredible grateful. Thank you so much, let me know if I can help clarify anything!
First thing that came to my mind is to have a separate UIImageView, with image something like this: http://www.creativecow.net/articles/ahearn_luke/creating_clouds/images/gradient.jpg (but transparent-to-white).
So - once You want to fade out Your image, You add as a subview a new UIImageView, which has frame like 3 times the width of the original image You want to hide. Once You add it as a subview, visually nothing would change, as the beginning of the hovering UIImageView would be transparent, But then You start animate frame (origin.x) of the hovering UIImageView so that it would be moved to the left side. While this happens, bottom ImageView will be gradually hidden from one side. After animation ends, You remove/hide both UIImageViews.
Not the best solution, but - if You are stuck, and still want the effect... Atleast some option.. Good luck!

weird gap when using uiscrollview and uilabel

here is the problem i have a tow muti-line label with many content, so I use a scroll view to show them all
then I follow this to do the autolayout: https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/AutoLayoutbyExample/AutoLayoutbyExample.html#//apple_ref/doc/uid/TP40010853-CH5-SW2
basic idea is to make a container view outside the scroll view to make sure the labels can fill the scroll view no matter what direction it is.
here is the hierarchy and constraint:
and the portrait mode works well:
but when it change to landscape mode some wired gap pops up!
and the more text i put in the label the higher gap i got!
my question is what should i do to kill those gap?
please give me some explicit solution or just give me an example, thank you!
and i am using autolayout in ios7, so some solution without coding are preferred!

Retain positions after pasting UIImageViews in new UIScrollView

I made a prototype for an app, just as a proof of concept to test whether the functionality is working properly or not. Now that I am satisfied with the working functionality, I want to paste the images I placed in a UIView into a UIScrollView, so that I can show data in different pages. But, as I select the elements and paste it in a scrollview, all the positions are lost, and I have to manually place the elements in the interface builder.
Check out this image, I have these many elements that I need to paste inside the UIScrollView.
Is there a better way of doing this? or do I have to manually place the elements in positions I want?
Thanks!
If you want to avoid the headache of repostioning of controls in IB, then try the following option
1) Take one more UIView.
2) Add the UIScrollView into the UIView.
3) Add your current UIView(view which you shown in question) into the UIScrollView.
Thanks.
Select all your children, then Menu/editor/embed in scroll view.
Et voilĂ  !

Resizing an NSView smaller than its subviews?

Couldn't find anything on the net about this and wondered if anyone on SO has a solution.
I have an NSView with several subviews that are centered by removing the left and right anchor points. When I resize my view, programatically or with the mouse, to a smaller width than the subviews: it pushes them off center. Has anyone come across this before and do you have a solution?
EDIT: I want to be able to resize my view to a zero width. The reason being, the view is actually part of a split view and I have hooked up a button to 'collapse' it. When it collapses all of the subviews are pushed off-center and aren't re-centered when the view is resized, effectively un-collapsing it.
I have solved my problem now and thought I would share incase anyone comes across this issue in the future.
No amount of playing with autosizing options or view layouts in Interface Builder seemed to stop my subviews from getting moved off center. I did manage to find this link here and from this page, the advice:
Springs and struts, as currently
implemented, are really no good for
anything but keeping either one or
both sides of a view "stuck" to the
nearest edge. Any sort of centering
behavior, division of gained/lost area
between multiple views, etc. has to be
done by hand.
Based on this I overrode my view's setFrame: method and manually laid out my subviews using their setFrame: method. This works great and gives me the results I'm looking for.
There is the same issue using NSSplitView, resizing here one Subview to be smaller than the Subview Subviews makes sense,e.g. having small charts in the upper subview, and an rss reader in the lower subview.
If you want to show only the rss reader in the lower subview, you can "hide" the upper subview, but after resizing the upper subview the NSImageView are not layed out the same as in the beginning. Check this nib/xCode Project and the following screenshot to see this behaviour.
Only workaroung is to override the resize function to stop getting smaller.

iPhone: how to support vertical scroll in UIPageControl

thanks in advance.
I have three UITabelView in a UIPageControl, but I could't scroll the UITableView vertically, can anyone tell me how to support this feature in this scenario? Or mission impossible...
Regards,
xiaojun
You should be able to scroll the table views in that scenario. My guess is that the UIPageControl is not large enough to allow user interaction with the table view. Try turning on the clipsSubviews property of the UIPageControl and see if you can still see the table views. Can you select a row in the table or interact with it in any way?