I am working on a project where users can upload the names of up to 10 songs. Everything works, I just need to display the “posts” when they are clicked. This will look similar to a post on other social network sites:
Username
Date of post
(Optional note - can be multiple lines, so no fixed height
Song 1
Song 2
Song 3
...
X likes
Username
Date of comment
Comment
So I basically have a UITableView to display the song and relevant information, such as the artist, album, song duration etc in separate cells. I also want to display the comments in a UITableView.
So, my question: should I add a UIScrollView and add all elements separately (e.g. the information on top as a regular UiView), because nesting UITableViews in a UIScrollView is not recommended? I have also thought about implementing the top and bottom views as a UITableViewHeader and UITableViewFooter, but then I am afraid for the dynamic height of both views.
Any suggestions on what might be the best approach to accomplish this?
I've got a screen where I have two UITableViews side by side - it's a quantity picker (count and unit type). Basically what I have is a "parent" view controller with 2 container view controllers. Inside each container there's a table view controller with the table inside. I can route all my table logic back up to the parent controller that way and keep all that in one place. I've done it in a storyboard using autolayout to simplify things, but it could be done just as easily in code. Not sure if it's the 'best' way to do it, but it works great!
Related
I'm building my first iOS app. I'm kind of stucked when I need to design something a little bit complex ( for me ).
I wan't to reproduce the Youtube App view when you watch a video.
Want I did :
Pinning a view a top the top.
Added a scroll view that fill the rest of the screen.
But here is the tricky part :
The scroll view must display videos details, suggested videos, comments.
What I think is to implement suggested videos and comments as two different table views. ( Because I need to put things between )
But the problem is here : The two table views will have their own scrollbar and I don't want that and I'm not able to get the dynamic cells sum heights etc etc ...
Am I in the wrong direction ? Please, how would you setup theses views ?
Thank you
PS : As we scroll down the comments the older must be added and then increase the main scrollview content height.
So do you want the suggested videos and comments to share a scrollbar? i.e, you scroll past the suggested videos, and then go into the comments etc?
The simplest solution would be to have one main view, which contains the UIView which displays the video at the top, while the bottom half is a UIContainerView, which would be linked to a single UITableViewController on the storyboard (If you're using storyboards).
The UITableViewController has the method numberOfSectionsInTableView, which you could set to 3 if you wanted 3 distinct sections (Suggested videos, comments etc).
In cellForRowAtIndexPath on the UITableViewController, you can check which section the cell belongs to with indexPath.section, and then degue the appropriate type of cell, which you would have created in the storyboard view.
As for the lazy-loading of comments, there are plenty of resources on this:
UITableView with infite scrolling and lazy loading
Basically you, just want to load or add more items to your datasource as the user scrolls near to the end of the tableview, and then call refreshData on the tableview.
This question maybe already asked in stackoverflow. But, I did not get any clear idea to my scenario.
I have a viewcontroller (Say, MyViewController).
I have a scrollview(Say, MyScrollView) and I have N number of views (Say MyView1, MyView2, ...) in it.
Those views can be scrolled horizontally. Refer the below image for more clarification.
This image was taken from here.
So, the red area is the scroll view that holds multiple views which are yellow color.
Scenario:
I want to call API's for each view, when the API calling and parsing data occurs, I need to show some loading activity indicator in the views. After successful parsing, I need to update corresponding view with UITableView.
Questions:
In my case, the number of views may vary from 3 to 6. Should I maintain 6 separate UITableViews and UIActivityIndicator's?
I tried with three pointers like left, middle & right to hold reference of tableview and activity indicator. But the problem is, before the first three pages are loading, if the user goes to the fourth view, this system will collapse with so many conditions.
Suggestions needed. Confused!!
I think you have to use UIPageViewController with UITableView. it will solve your problem.
I am having an app in which I want my view to be loaded like shown in the screen shot below.
The following view contains page control to show multiple images,buttons,labels,resizable text view and resizable text field in a single cell of table view.
There will be number of rows in a table view and rows will be generated dynamically.
Is there any cocoa control or tool which can give me functionality like this?
I have searched on cocoa control and goggled it a lot but couldn't find any matches to achieve this.
I thought of taking different views with sub viewing it didn't get much idea of how to generate it dynamically.
Please help me if someone has achieved this kind of functionality in any of their projects.
Thanks in advance.
Hint :
Divide each items in cells for single section, that means, one section for one item.
for e.g.
User photo, User name, User location and Post time in one cell.
Image gallery in another cell with page control on it.
Favourite (liked) post, comment on post and price in individual cells.
what you've to do is, create and add each item in a cell. While you're giving the height of each cell using delegate, check for conditions for which you're assigning the height. For e.g. if you've likes for the post (favourite) then only give height for that cell otherwise pass 0 (zero). Do the same for everything or as per your requirement.
For comments, you've to calculate text height, and based on that, you'll need to set height for comment cell.
References:
Here's a nice tutorial for this (not exactly) stuff. Rebuilding Instagram Feed Table View. I also googled a lot and found this, https://www.cocoacontrols.com/controls/stxdynamictableview, you may also need https://www.cocoacontrols.com/controls/mhpagingscrollview for showing image gallery.
P.S. This is not a "lunch plate" of course you've to make it for your self. Get hands on the keyboard! :)
Good luck!
I need to display students timetable in an application; a TableView contains a complete week, from Monday to Sunday. I'd like the student to be able to go next week by swiping horizontally, finding a new UITableView filled with the new week.
In other words, I'd like to scroll like photos on Facebook, but with complete UITableView filled with pieces of data.
How to do this programatically? Embedding several UITableView in a UIScrollView?
Thanks a lot...
Sincerely,
Hervé
I've done this before using a UIScrollView with paging enabled.
The other alternative which is slightly more complex but makes it easier to manage each individual table separately is to use a UIPageViewController.
It sits behind the view controller views sort of like a TabBarController or a NavigationController.
You manage it a bit like a UITableView in that it has a datasource and it will ask for the "view controller at index".
Examples of this being used are in the Photos app when you are looking at full size images.
I would suggest you to use UIPageView controller with UIView.... and you can use animations on those views whatever you like.
So what I'm looking to do is have a UIPageViewController that will end up displaying three view controller vies, one fully visible and then two as previews to the right and left. An example would be the iOS6 App Store:
Is doing this using a UIPageViewController set to UIPageViewControllerTransitionStyleScroll possible?
Basically I'd ideally like to have is a case where I can have three UIViewControllers that I recycle as the user pages through the 1- items in the list (with n being at least 50). I know an interface that behaves like this can be done with a UIScrollView with paging enable, but re-using views would take some view shuffling code that I'd rather not write if Apple has already done it for me.
I'm totally comfortable with the fact that this is iOS6 only, by the way, and also comfortable with alternatives, if they exist.
Thanks!
Check the new collection view. I think you may be able to create something like that with reusing cell etc.