Syncing Two CollectionViews For Navigation - ios

I’m trying to sync two collection views proportionally for navigation. One of the collection views is menu-like and is at the top, and the second is a larger one below. What I would like is for the top collection view to scroll a distance of the width of one cell (the cells are dynamically sized) when the user scrolls the bottom collection view a distance of the main screen’s width. The closest thing I've seen to this effect would be iOS: Custom top segmented control works as expected only when using debugger. What I would like to change is to have the left most cell in the top menu always selected. In addition, when the user scrolls the bottom collection view the width of the screen, a new cell should Replace the left-most cell in the upper menu and be selected. Any help in Swift would be especially appreciated, but ObjC answers are also welcome.

Related

XCode - Vertical TableView Carousel Style Scroll

I currently have a table view populated with a series of posts. What I am trying to achieve is to manipulate the table view scroll so that there is always one table view cell centred in the table view. I'd also like this to have some form of scroll snap, similar to a vertical carousel in which the centred / focused cell has a maximum alpha and original size, and the cells visible above and below are smaller and have a lower alpha. I have attempted using scroll target offset but with no luck. I am mainly struggling with the mathematics of the function.
The image below demonstrates what I am trying to achieve.
What I am looking for at the very least is a push in the right direction in regards to how I can manipulate the table view scroll to have this type of carousel function.
EDIT: Is it possible to achieve this with Paging in the Table View?

How to set Table view cell to occupy entire screen?

I am working on a project to get custom news feeds from Bing news. I created a custom table view cell and populated various UI items in it. But I am having a hard time to make it occupy the entire screen, it starts from extreme left and ends on the right, leaving large gap from the right margin as show in the image. Can anyone help me out, how to correctly fix it with a detailed explanation of how constraints work in Table views and Tableview cells.
Here' what it looks like in the simulator
Remove previous constraints and add constraint to your UITableView like as shown in below image.
So you UITableView will have 0 margin from edges.
Create a UITableViewController. Just drag drop a TableViewCell into it. Add identifier for that cell and use it. By default it will occupy the whole screen.
In your case I guess you might have added constraints to UITableView. Here what you should do is pin your UITableView to Top,Bottom,Right & Left or make UITableView's width equal to SuperView.

Invisible and not selectable objects in cells scrolling down a long static table view in IB

Actually I'm using XCode 7 and I'm trying to lay out a static table view in IB. I have "sizes classes" ticked (adaptive layout) and the table view is taller than the default square scene of 600x600 points. I can work fine with the cells in the top 600 points of the scene, that is its height.
When I scroll down the height of the scene, I can't select table cells by clicking on them in the scene (but I can in the outline). When I drag any object (e.g. a label) onto one of these cells, it goes into the view outside the cell and when I put the object inside the cell by dragging it onto that cell in the outline, I can't see it on the scene neither move it by dragging (it's like it was behind the cell's content view). May anybody help me?
It's a very weird behavior... I'm getting crazy!
I'm not sure if is the same problem, but I had problems editing statics cells when there are many. So in the size inspector of the view controller I set the simulated size to "freeform" and increase the height to unreasonable levels (2000), and then I can access the bottom cells.
Here a screenshot.

UITableView not following constraints

I have in the bottom of the screen a view containing 4 image views that I use as navigation buttons. That view is pinned to bottom layer by "0". Now my tableview is above this view and I have made a constraint of "10" from tableview to my "navigation view." I have two problems. When my tableview contains more rows than the screen can hold it puts the cells "behind" my "navigation view" even though I made the constraint it shouldn't. Now when I flip the screen to landscape mode it actually makes my navigation view disappear from the screen. I don't understand why as I pinned the bottom view to bottom layer. (2 questions)
Then of course my 2nd row decides to use much bigger font when I load in more rows, which is something I don't even want to bother you guys with yet, I think my simulator is playing tricks with me..
Anyway, I appreciate any help on my 2 problems above. Thank you
EDIT: Here I took some pictures:
http://i.imgur.com/LA9Spt0.png (this shows what i mean with the tableview pushing away the lower view even though the lower view is constrained to the bottom layer and the tableview has a constrain leading to the lower view (menu bar))
http://i.imgur.com/b6VoqFk.png Here what happens when I "pull" the tableview downwards to see more cells it blocks the upper label and top bar (which contains the logo I had to remove for reasons with the company) I tried to use :setBounces and setAlwaysVertBounces set to NO but then I can't scroll down the tableview when more cells exist.
(addition to img. nr 2)multiple cells makes the cells hide behind the lower menu navigation bar. I did make a constrain between the tableview and lower menu bar, shouldn't I be able to make the tableview "create" a scroll bar so u can scroll down instead of cells hiding behind the menu bar.
Thanks, any help much appreciated!
It sounds like you have some conflicts, or missing constraints.
You can see if you have constraints errors in the nib, in the 'view hierarchy' column in the left side of your nib, you will see a little red arrow..
Or that you have some conflict which you can see at the console when running you app.
Thanks

Unnecessary padding in tableview cell iOS?

I am developing an enterprise iOS application that uses splitview to display information. My split view, tabbars are all in place and seem to work fine. I have a tableview in the left pane of the splitview. The tableview has custom cells which contain an image view and several textview (removed textviews in the img) The height of the image view is same as the row height of the tableview and tableview cell. I wish to achieve a row height of 182 points. Even though I have kept all size same I see a padding on the left, top and bottom of the tableviewcell. In the tableview the cells thus appear separated by the background color. The tableview has no separators set. The only problem I see is that the image used inside the cell is only 168 points in height.
I did the same stuff in the detail view in the split view however now I see the table cells occupying the entire area designated to it. The image inside this detail view cell is only 160 points in height yet to I do not see that "padding" effect.
I have attached a sample screenshot, pls let me know where to fix it?

Resources