Swift: Programmatically set a view before first line of UICollectionViewController - uicollectionview

a bit confused reading in the Apple documentation, tried multiple settings but no luck so far, so I hope to have a response here.
I am implementing a UICollectionViewController with header and vertical scrolling.
All work flawlessy but now I want to add a view in which I want to put an TabBar below the header and before the first line of the collectionview.
I want also that the tabBar moves when scrolling so i can't just add a subview and let it disapper once the scroll starts.
I suppose I have to set the spacing for the first line to be big enough and once done create a view, add the subview and create the tabbar inside of it.
Now the question , which sections of those I have to override? https://developer.apple.com/documentation/uikit/uicollectionviewdelegateflowlayout
Thanks.

A better approach will be to implement the view to be added as the first cell of collection view.

Related

Add Gesture Reconizer Outside UItableView Inside ContentOffSetView

I have added content offset to my UITableView.
For better positioning of my Table and now, I would like to dismiss my UITableView When User taps on the Content Offset Part of My table view.
How can i add this?
Strictly i dont want to add anymore views above the table in my screen.
Have done like Reference to the answer
https://stackoverflow.com/a/39062209/5215474
Without seeing exact code, I would do the following:
Add a UIGestureRecognizer to UITableView
Use a combination of scroll position and the point touched in screenspace to determine if a touch happened where you want.

How to add UITableView to one of several subviews using storyboard

I have one UIViewController with two UIViews on it. In the Navigation bar, when one button is pushed one of the UIViews is displayed and when the other button is pushed the other UIView is displayed. I want to put a UITableView on one of the views. However, the UITableView requires the UIViewController to use the UITableViewDelegate and UITableViewDataSource. Having implemented this for my UIView (subview) containing the UTTableView, when I click on the button for the other view, which does not contain a table, I get errors and the application croaks.
I am assuming (possibly incorrectly) that my issue is that I am trying to use the same UIViewController for both subviews, but only one contains a table.
Question 1) Is it possible to do what I described above? Meaning, if I had a problem then something was not connected up correctly.
So, I went down a path of creating two separate UIViewControllers; one for each view. Not sure this is the smart approach. Now I am just looking for advice on the best way to do this. Thank you in advance for your help.
To be more clear about what I am trying to do. I want the blue view to be put where the pink view is when the first button on the bar is clicked and I want the yellow view to be put where the pink view is when the second button is clicked. Essentially the pink view will never be displayed and may not even need to be on the UtilityViewController.
Having each as a UIViewController (or a subclass thereof) is the way to go about what you are trying to do. The UITabBarController does this already: https://developer.apple.com/library/ios/documentation/uikit/reference/UITabBarController_Class/Reference/Reference.html

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.

Flipping between views has UITableView position issue

I have a UINavigationController within a UITabBarController. Within the navigation controller I have a ViewController that looks after flipping between two views using transitionWithView:duration:options:animations:completion one of the views i am trying to show is a TableView.
The problem is when showing the TableView it is off position.
and the flip view
I have tested flipping between two standard views without issue, it is only the TableView that shows off position. Also when the Tableview has more data then can be shown on screen the bottom rows are hidden by the Tabbar. It looks like the frame size is wrong but I am not sure how to proceed to fix the problem.
Full test project and code can be found on GitHub
Any suggestions or help is greatly appreciated.
The root of the problem is that you are using UIViewControllers (FlipSide and FlipMain) as subviews for FlipController which is itself a UIViewController. Prior to iOS 5 this was not supported and inevitably led to problems. iOS 5 adds support for a view controller hierarchy but requires that you use the appropriate new methods.
You have a couple of choices: restructure the view controllers so they are not nested, rewrite the sub-controllers as UIViews, or use addChildViewController to add the subcontrollers.
I've forked and modified your original code here to illustrate that changing to UIViews resolves the problem with layout.
It's a bit hard to answer without the full code, but I would try playing with the "wantsFullScreenLayout" property of your view controllers. I say that because the offset seems to be 20px high, which corresponds to the status bar's height...
Let me know if this helped ;-)

Why isn't my tableview visible?

I'm an sdk newbie, so please forgive the simplicity of this question. Here's the scenario:
I used the Utility Based application template because I like the flip effect of the info button. I changed the info button to a round rect button and made a copy of it that to have two round rect buttons on my first view. I modified the flipside view to display a picture and that functionality works fine. For the second button I wanted it to flip to a tableview underneath the navigation bar. I added a navViewController for the navigation bar and a TableViewController for the tableview. I made a nib for that View, added the tableview, hooked up all the appropriate connections, but when I run it, the flip works fine, but there is no tableview displayed. What I mean by no tableview is it is blank. No lines or anything, just a blank navigation bar at top and blank white space. Please help! Thanks!
With limited information you have given here:
Potential Problem 1 - First Level UIViewController is not linked
If you open NIB file in interface builder where you have drag and dropped NavigationViewController, you will see small disclosure triangle. If you expand that you will see NavigationBar and UIViewController. Select the UIViewController and change it to name of the TableViewController.
The NIB file will change and say View Loaded from YourTableViewController.
Potential Problem 2 - You have to do addSubView or insertSubView and pass in [navigationController view]
If you post some code it may be helpful.
Hope this Helps!