Custom tableview scroll iOS - ios

I need to show three/ four UI buttons and levels, two image views in a custom cell but there is a condition on the basis of that I need to hide an imageView and when it will be hidden, I need to decrease tableview size and buttons which are below of that image view that will move upward.
For that I am giving required conditions in
heightForRowAtIndexPath
and returning cells height accordingly and in tableview
CellForRowAtIndexPath
method I am hiding imageView and setting buttons positions which are below of that imageView.
The problem is that:
1) TableView is not scrolling smoothly
2) Initially at the time of scrolling down everything is working but when I
move upward then image is resizing and changing its shape. To solve that I have used AutoLayout but still it is not working.
I need your expert advice.
Thanks in advance.

Related

Mixing UIScrollViews and UITableViews

If you look at the Featured tab of the Apple App Store app on an iPhone 6, there is a unique UI layout that I can't figure out how to replicate.
At the very top there is a navigationBar. Below this there is a UIScrollView that animates through a number of featured items. Below this is what appears to be a UITableView with a number of custom programmed cells.
My first guess was that the UIScrollView at the top was added to a custom cell at the top of a UITableView. If you swipe up the UIScrollView moves with the objects below like it is a cell. You can see that the vertical scroll indicator starts at the top of the UIScrollView.
The part that is unique is that if you swipe down, the objects below the UIScrollView move down like a UITableView and the UIScrollView stays in place. This means that the UIScrollView is not a custom cell at the top of a UITableView.
I tried making this work a number of different ways but I can replicate this. Does anyone know how this can be done?
You can use a tableview header,the header is a scrollview
If you scroll tableview up,just use tableview default behavior,the header will scroll up.
If you scroll down,use UIScrollViewDelegate to calculate the tableview header new frame,and adjust it.So it remain at top
Not sure if I got you correctly, you may use UICollectionView as vertical scroll. Then, you create a custom UICollectionViewCell, each with horizontal scroll.
I haven't tried it though but done something similar to this. Hope you find a way!

iOS8 UITableView and Cell - Autolayout Height - Shift / Vertical offset bug on touch and perform segue

I have an annoying problem with my tableView when i touch a cell which contain an autolayout label (description of the image). The autolayout works well, but, just when i touch the cell before the segue, a cell shifting movement appears (down or up and never the same height).
Don't understand why and this problem is random , I feel it rather happens when a cell is close to appear at the top or bottom.
Here a video of the problem on touch / click on the cell and transition to an another view.
http://youtu.be/kJALa8PhD-U
Image : http://i.stack.imgur.com/uWzDr.png
Reminds something to someone ?
On IOS8 - Swift, Same problem on my iPhone.
Thanks!
Likely what is happening is that because you are using auto layout to get a dynamic height tableviewcell, and iOS is not properly calculating the height of your cells during the segue. Using either the estimatedHeightForRowAtIndexPath delegate callback (if you have varying heights) or the estimatedRowHeight would be my guess at how to fix this.
Doing this should get you two benefits, firstly your views should stop flickering during the segue. Secondly, iOS will not have to look at all of your tableview cells to determine the height of it's scroll indicator (which is good for performance).

Infinity backgroundView in tableView

I have UITableView with background image and then I scroll it I have parallax effect like background imageView scrolls too. Problem is that then my image finished I have tableView background. Is it possible to make infinity imageView? Like then I go through image then starts this one image from beginning.
In next few days I will add lib thay solved it and creates parallax effect under tableView
https://github.com/bizibizi/TableView-Parallax-Background
Can you show me how are you placing that image behind the TableView? I guess the hierarchy in the storyboard should be
UIView -> UIImageView -> UITableView
The size of the UIImageView and the UITableView should be the same. So when you scroll up and down the UITableViewyou could see the image in the background.
But please explain your scenario abit more so that I could suggest you something appropriate.
What Hanny means is that you need to have the tableView on top of imageView ordered in the stack of the parent view's subviews. What you can also do is stack two tableviews on top of each other, and add a touch event that moves both table view's scroll views. The image table view would contain cells that are the size of the whole view frame.

How can I make UITableView less sensitive to vertical scrolling?

I have table view that has more than 10 rows and inside each row I'm placing a hortizontally-scrolling scrollview (you can thumb through images much like in Coverflow).
The problem is that UITableView is too sensitive to vertical scrolling. When I'm trying to scroll left and right in a particular scrollview (inside of any cell), the table view starts scrolling up or down once it detects even the slightest movement of my finger upon the y-axis.
Is there a way I can change this and set a higher vertical-scroll threshold for the table view?
Here's a couple suggestions. Try them and see how they feel.
Suggestion 1
When you dequeue your tableViewCells, try calling this:
[tableView.panGestureRecognizer requireGestureRecognizerToFail:cell.scrollView.panGestureRecognizer];
Suggestion 2
Try setting this on your tableView:
self.tableView.delaysContentTouches = NO;
That property defaults to YES. It delays touches to the content of the table view cells by a fraction of a second, to help it recognize the difference between a tap and a drag.

UICollectionView with custom UICollectionViewLayOut

I am trying to have the content in a uicollectionviewcell grow bigger when it scroll moving in one direction. i initially set the size of the cell to the largest size i want, then the content inside the cell is half in terms of the size. the content is an uiimageview.
So I have a custom UICollectionViewFlowLayout in which I subclassed the layoutAttributesForElementsInRect to make the uiimageview in the cells grow bigger when it is moving in one direction. i also have shouldInvalidateLayoutForBoundsChange to return YES
Everything works perfectly when i scroll, the imageview will grow larger. However if i select a cell to push to a new viewcontroller, and then when i click the back button to come back to this uicolletionview, the enlarged uiimageview in severals cells are showing in the original size. They can only go back to the correct enlarged size if i scroll again, why is that? and how can i make it keep its enlarged size after getting pushed?
i tried invalidatelayout but it will just refresh the layoutattributes with correct enlarged size of the content, but the view is just not updated eventhough the size is already enlarged.
thanks
I had a similar issue when designing cv cells and would gess the issue is with when the subviews get calls to update their size, which might not happen when the view refreshes.
Instead of resizing content in the cell, you might want to dynamically size the cells themselves and have the content automatically adjust to that size. Calling [mycollection invalidateLayout] then should be all you need, maybe not even that.
The method is
collectionView:layout:sizeForItemAtIndexPath:
which you declare in your UICollectionViewFlowLayout.h
If you then run into trouble where subviews do not resize with cell size, related problems can arise from constraints/autolayout etc of the subviews.

Resources