Stretchy header view for UICollectionview and minimize UIImageView while scrolling up - ios

I am trying to achieve a certain layout that looks like twitter and many other apps. Some people do it in UIVIewLayouts but I want to achieve it using this way (if possible ). As you see in the attached image. I have Header, and cells in the collectionview.
While scrolling up I want to minimize the imagview avatar inside the headerview. -> ( ViewForSupplementaryEelementHeader )
while scrolling down, I want to make the top UIImageview to be fixed to the top and stretchy
Thank you all in advance
*ps I am doing all of this in code nothing with storyboard and I dont want to use it at all.
Please advise me how to access these imageview while scrolling up and down.

I think this is the example you are looking for
https://github.com/sunlubo/StretchyHeaderView
This will add only tableview in storyboard...other all the work is done through coding

Related

How create a tableView that covers an image when it is scrolled

I'm trying to develop something like CSStickyHeaderFlowLayout but customized for my table, but I'm not sure how can I achieve this goal. The idea is
Someone can give me a hint how achieve this objective?
To add to Vollan's answer, to make the title stay still you could use a view that contains two subviews: the first is the scrollview (with the image and table as Vollan suggests) and then add another view (like a UILabel) for the title. Thus, while the image and table scroll in the scrollview, the title will stay still.
Best solution would be to wrap everything inside an UIScrollView. That will allow you to scroll to bottom of the screen and then only scroll the tableview. That way it will appear like the tableview will overlay the image.
While using a tableview within a scrollview would likely work, your tableview would have to always be it's full size (without some annoying constant re-sizing), so you'll lose the value of the enqueuing/dequeueing that makes tableViews work so well.
The CSStickyHeaderFlowLayout has example pretty similar to what you want to do, did you look at their examples? You may be able to play with it and get it to do what you want If your problem is simply having a constant title, you can just add a view above the table or use the NavBar and adjust the contentInsets
You might also consider using a collectionView instead. It's much more flexible as far as layout goes.

UIPageControl or Horizontal UICollectionView?

I am looking to achieve a similar effect to the Netflix app where at the top they have a scrollable header displaying different 'featured' movies.
As soon as the header start to scroll and the next image enters the view it downloads the image, also while being scrolled if you let go it snaps into place the image that was currently being shown the most.
I am not sure how to proceed and try to solve this problem. Any suggestions? should I look at using UIPageControl, or should I use a horizontal UICollectionView?
Thanks
You can implement it by using a horizon collection view,it can help you handle the reuse of imageViews!Or you can use a UIScrollView to contain a couple of subViews to display the image or three subViews and switch the image content

Working with UIScrollView and UICollectionView

In my project, I'm trying to do an app similar to Instagram where I can scroll endlessly on the images that I have inside my personal profile. While scrolling, the top portion of my profile details is above where the whole screen will be filled with my photos when continuously scrolling thru my photos.
I think the way to achieve this is using UIViewController and working with UIScrollView and UICollectionView. However, my issue here is how do I create a custom height of the UICollectionView or UIScrollView in order to show the proper or exact height of the View? As such, I do not want to see "white spaces" at the bottom, or "cut" pictures.
I've tried using let height = CGRectGetHeight(self.myCollectionView) to get the height, but it always return me with the height I fixed in my IB regardless the number of items I have.
Could someone share with me the structure how I should do it? Many thanks!

UIScrollView with multiple UIImageView shown

I'm trying to achieve scroll view with multiple images. I put the UIScrollView and put 3 UIImageView which the last one is out of bounds. I though that i can scroll the content of the srollview component. How could i achieve this. I have just found examples where the scrollView show just one picture at the time. How could i have multiple pictures shown in UIScrollView.
Something like this:
Thanks
OK the correct method which i was looking for is setContentSize. I thought that there is some setting to do this automatically to the included content. But as Grett writhed there is nothing like that. So i guest this is the only way do that.

iOS UITableView cell layout questions

I have a chat on a web site that looks like this.
I am now building an iPhone app for this and have some problems creating the same layout. I hope you can point me in the right direction. Is subviews or webviews the best choice?
If using UIView, UILabel and UIImage, what is the best way to make rounded corners and the little arrow. The gradient background should not scroll with the table view. What's the easiest way to calculate the hight of each message? What is the best way to async load the images over http?
If using a webview, what is the best way to populate it with data? Building string? Having a template and populate the image, username, time and message thru JavaScript? How can I resize the UITableCell and UIWebView to fit the contests?
Will a table full of UIWebView be much slower than using labels? Will I need to create it twice to return the height of the cell in heightForCellAtIndexPath and add it in cellForRowAtIndexPath?
Thanks for your help!
If you wish to see it live, visit www.aktieguiden.com
This is really a lot more than two questions, and I'll answer several of them.
I would use a table view with a resizable UIImage and a UITextView for each bubble. Use an image of the bubble in png with a transparent background, and make it resizable. Import it with UIImage's -(UIImage*)resizableImageWithCapInsets:(UIEdgeInsets)capInsets. To determine a height, UITextView has a contentSize property which will tell you the size of the view that can be scrolled. For asynchronous loading, use one of the many tutorials or frameworks for that purpose. Here is one:
http://developers.enormego.com/view/what_if_images_on_the_iphone_were_as_easy_as_html

Resources