A managed subview of UITableView - objective-c

I have a UITableView that I populate with cells in the normal fashion using the datasource and delegate. I would like to add a custom subview, that does the following:
1) scrolls with the UITableView
2) is seen beneath the UITableView scrollbar
3) can be moved and animated independently of any cell (acts as a selector that animates from one cell to the next)
I know how to animate a selector over the top of the UITableView, but that violates requirement #2 (it makes the scrollbar look terrible)
Has anyone seen an implementation of this, or know the proper way of doing it?

Did you try something like this?
Have a base view.
Add your custom subview to the base view.
Then add your table view on top of it to the base view.
Implement the table's scroll delegates and move the custom subview.

Thinking at the top of my head, couldn't you disable the scrollbar for the table view and place a transparent scroll view with the same dimension as the table view on top. You're effectively using the scroll bar of the scroll view instead of the table view. You'd scroll the scroll view in step with the table view.

Related

How to pan down a view controller in storyboard

I'm using a scroll view in the storyboard for one of my view controllers and I would like to know if there is a way to move the current view of the view controller down so that I can add things below.
I've seen that when tapping on CollectionView (which is at the bottom of my screen and extends below the view), the view on my viewcontroller seems to move down a bit to reveal more of the CollectionView, but not entirely. Is there a way that I can make the view go lower?
Change the size of viewController as shown in the image below:

Extend the edges of a UITableView under NavBar and TabBar in UIViewController in iOS 7 to get translucent effect

If I use a UItableViewController it works fine but I need to use a UItableView inside a UIViewController instead. My question is, do i have to manually program it to add extra space at the top and bottom so the first and last cells won't be partially covered and how would I move the refresh indicator down so that its not covered?
Make sure your table view is added as the first subview of your view controller. This will ensure its scroll insets are setup properly.
Also be sure to set the table view's frame to match the bounds of the view controller's view and be sure to set the autoresizingMask to flexible width and height.

Custom Table in UIViewController Objective-C

I want to create table view inside of UIViewController like a below picture (I mean the second screen)
what is the best solution? "creating UIViewController then tableView and inside of tableView having custom cell"?
would you please give me some hint?
Thanks in advance!
So basically you want the tableview to not fill up the entire space. Yes, you can surely do UIViewController, let it implement UITableViewDelegate and UITableViewDataSource protocols, throw in a tableview and hook up the protocols, and use custom cells.
If you only want the tableview to not fill up the space horizontally (but it can still scroll all the way until it reaches your navbar), then you can just create a UITableViewController, and set up your cell background in the way you want. More specifically, you create 640px (or 320px) wide background images still, but only the central 600px, say, is filled in. The 20px to the right and left are transparent. (You need png to do this, of course) If you apply this background to your cells and apply another background to your self.view, then you can actually see your view background under the 20px on the two sides.
Note that if you choose the second approach, the cells are still full width; it's just that you are visually making them look like narrower. That's perfectly ok, but you need to customize your highlight background, too.
Looking at your picture, it seems you need to create UINavigation Controller as your parent view controller and add UITabBarViewController as its rootview. then in your second tab when your click on the cell inside the table, you pushview to another view which displays your picture
create a tab bar controller project. Every tabbar item will be a navigation controller.
Tat way u can manage both the navigation and tabs.

Fixing the position of a header view within a table view controller

As part of my application's design, I have placed an image inside of my UITableView's header.
This header image looks great, until the table is scrolled, moving the header relative to the position being scrolled to/from.
My question is, how do I stop this from happening? I'm assuming I'd have to do it another way, i.e. put a UIImageView above the UITableView so it has nothing to do with the scrolling. However, I cannot put a UIImageView outside of the UITableViewController.
How would I do this?
Create a view controller which has this view hierarchy:
view
\---> header view //set the frame to be the top 200 pixels or whatever you want
\---> table view // instead of being the top view, the table view is a subview with a frame starting below the header view
Set the tableview delegate and datasource and use them as normal
To solve my problem, I used a group tableview as their section headers scroll with the content and don't 'stick' under the navigation bar, i then stretched the tableview to an extra 10 each side, and pushed it 10 points to the left, 'getting rid' of the margins.
I then used custom tableview cells to design my own custom cells.

UITableView in a UIScrollView - How to make the view scroll, but not the TableView in itself?

Imagine, there is a UIViewController with a UIScrollView in it. At the top of the view there is an UIImageView, some UILabels and other things. Furthermore, there is a UITableView which content is Dynamic Prototypes. I attach a picture to make it clear:
I haven't got a static amount of cells in the UITableView so it could be scrollable. My problem is the following: the UITableView scrolls in itself but I want to scroll the whole View. What is the best possibility to do that?
Possible solutions I've founded today
1) The first thing is: I create a UITableViewController and declare a header section in which I include all my labels, images etc. programmatically (I would love to use the interface builder for that...)
2) Another solution is to calculate the height of the view. I tried the best to do it like this way - but: without success. If this is the best way to do that: Can anybody give an example?
I would ditch the UIScrollView and just use a UITableView. You can add a UIView object as the tableHeaderView of the UITableView just by dragging it in in Interface Builder. Now since everything is part of the UITableView hierarchy, everything will scroll together as expected.
You could also try setting delaysContentTouches to NO on your scrollView. Depending on your setup, this may make the scroll view respond to the touch first instead of the table view.
From Apples UIScrollView Docs:
delaysContentTouches
A Boolean value that determines whether the scroll view delays the
handling of touch-down gestures.
#property(nonatomic) BOOL delaysContentTouches
Discussion
If the value of this property is YES, the scroll view delays handling
the touch-down gesture until it can determine if scrolling is the
intent. If the value is NO , the scroll view immediately calls
touchesShouldBegin:withEvent:inContentView:. The default
value is YES.
You'll have to (as you've mentioned) add the UIView containing the image and buttons to the actual UITableView. Embedding it in the scroll view will produce the undesired behavior that you're seeing.
I would recommend returning the UIView as the header view for the first section of your table view. You can do this by implementing the UITableViewDelegate method:
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section;
If you maintain an IBOutlet to the view containing your image/labels, you can return it here.
this is same demo i hope its helps you from iphone sorce code library
http://developer.apple.com/library/ios/#samplecode/iPhoneCoreDataRecipes/Introduction/Intro.html
thank you