I currently have a table view with all my cell names which when clicking on a specific cell you will be directed to that page with the use of a segue between the two to keep them linked, which is fine for example click the Hello cell and the hello page will be displayed. I have a label linked within the second view controller to match the cells name when loaded so that it only loads content specific to that cell. Now I'm attempting to add an embedded container view within my second view and I want it to work in the same way. For example person click Hello cell, Hello view controller appear and content within container is relevant to that cell as well. Currently the label inside the main view controller controls what content goes in, how would I got about adding a label within the container view controller with the same concept. (Second view controller and container view controller should have same label title when cell clicked)
I'd suggest looking at prepareForSegue and passing a parameter property that way. Then in the destination view controller you can parse that and switch content based on it.
https://developer.apple.com/library/mac/documentation/AppKit/Reference/NSSeguePerforming_Protocol/#//apple_ref/occ/intfm/NSSeguePerforming/prepareForSegue:sender:
Related
So the set up is that I have a view controller called settings. Within that vc, I have a container. I then have a Table View Controller that segues into the container via an "embed segue". (This is set up as a static table). When I run the app, the settings view controller displays with the table set inside the container view. How can I use that segment control in the settings view controller (parent class for settings vc is settings.swift)? The table view has the default UITableViewController as a parent class.
The left most screen is how it appears on my phone when I run it. (Right screen shot is different as I took that before simplifying it to just a segment control)
My question is how can I get the selectedsegmentindex from a segmented control (within a table view cell that belongs to a static table view)? Is it even possible?
What I would do is give the segmented control a nil targeted action. That will successfully call the action handler implemented in any view controller up the hierarchy.
I'm currently using a table view and table view cells in a menu. When you click on one of the cells, it uses a segue inside storyboard to take you to a different view controller depending on which cell you click. They are all different links and the same view controllers except that I change which link opens on which view controller. I know this defeats the purpose of OOP because I'm having individual view controllers do pretty much the same task instead of not having one link opener view controller. How do I get the names of the table cells dynamically in the view controller after a segue?
So I have a UITableView that navigates to a detail view when a cell is selected. Each cell and it's detail view passes through different data depending on which cell is selected. On the storyboard it is one generic detail view with a text label and an image view that loads in data from an array.
What I want to do is navigate from the current detail view to the next detail view (for the next item in the table) without having to go back to the main table view controller. How can I do this? I would like to do this with a button.
I have looked at this but I can't seem to get it right/not sure it's exactly the same thing: Navigate between sibling detail views of a parent table view
I am trying to implement a feature using PageViewController in iOS Swift language. In my scenario there will be images on all views associated with PageViewController. I will have buttons on top of images, (refer to example app's screenshot.) How can I implement that with change of page only the image slides not the buttons.
Finally I was able to do it, by following steps:
In your storyboard, create a standard Viewcontroller scene.
To this scene add your fixed buttons and a container view. Adding
the container view will automatically add an embedded view
controller. Select this and delete it.
Drag a Page view controller into the storyboard.
Select the container view and drag from the "viewDidLoad" item in
its "triggered segues" list to the page view controller. Select
"Embed" as the segue type.
Following delegate methods are to display dots of page controller, dots will appear at bottom of view.
presentationCountForPageViewController
presentationIndexForPageViewController
For your requirement need to create custom UIButtongroup or UIView group, so that you can place it anywhere in page.
I'm trying to replace a child view controller via a push segue in storyboard. With this code I got it almost working
Well now I only have the problem that my new view is bigger than the first child view. So I of course want it embedded in the container so the user can scroll down within the container and that the container doesn't overlap my footer. Where do I need to change that?