I'm looking to segue into another controller while still partially showing the parent container. Similar to when you start a new email message from the iphone mail app (See screenshot below). I've searched but could not find an example or answer.
For Example
Related
I have a view controller which has a container within it which connects to a child view controller. Everything was working great as I constructed my layout within xcode for the child view controller.
However, once I gave the child view controller a custom class name it no longer loads up properly when I start my app.
Scenario 1: Child view controller has no custom class name, no problem! Loads up as expected:
Scenario 2: I give child view controller a custom class name so I can give it functionality. Does not load up as expected!
So I can't controller my child view controller since when I attempt to connect it to a class to do so it no longer shows up. This is the first time I've used containers, so I'm not sure what I'm doing wrong.
So it was a really simple resolution when I figured out what the problem was. When I created the class file I used 'Cocoa Touch Class' which includes a bunch of functions from the get go. A large number of them are commented out, except for some reason doesn't comment out overrode functions for number of sections + rows (why this is I don't know). Once I commented out these functions like the rest of them, it's loading as expected now...
This question already has answers here:
What is the difference between a View and a View Controller? [closed]
(3 answers)
Closed 7 years ago.
Coming to Swift from Delphi, I thought the View represented an app's GUI and the storyboard was a visual representation of the View's underlying code. The ViewController was the one and only object the View interacted with. When a popular tutorial says
In the old days developers used to create a separate interface file
for the design of each view controller.
I'm thinking the "separate interface file" was the View file. But as I learn more, I'm getting confused. Beneath a screenshot of an empty Main.storyboard from a new application, the text says
The official storyboard terminology for a view controller is "scene,"
but you can use the terms interchangeably. The scene is what
represents a view controller in the storyboard ... Here you see a
single view controller containing an empty view.
So I'm seeing a "single view controller," not a view?? Confusion mounts when I note any views(?) displayed on a storyboard are called "View Controllers" in Swift.
So, what's the difference between a View and ViewController? How is a storyboard related? And what object "owns" something like a segue, which exists outside my (flawed) understanding of these concepts?
Take a look at this post - What is the difference between a View and a View Controller?
This described it pretty well for me.
If you don't want to go to the link, here is a great description of the difference between a view and a view controller by Alex Wayne:
A view is an object that is drawn to the screen. It may also contain
other views (subviews) that are inside it and move with it. Views can
get touch events and change their visual state in response. Views are
dumb, and do not know about the structure of your application, and are
simply told to display themselves in some state.
A view controller is not drawable to the screen directly, it manages a
group of view objects. View controllers usually have a single view
with many subviews. The view controller manages the state of these
views. A view controller is smart, and has knowledge of your
application's inner workings. It tells the dumb view objects what to
do and how to show themselves.
A view controller is the glue between your overall application and the
screen. It controls the views that it owns according to the logic of
your application.
My application consists of a tabbar controller with several tabs, each with a navigation controller in them. One of these nav controllers contains a table populated via a web service. I'd like to have an overlay on the table (or a different view) that says the service is not reachable if it isn't reachable. However, I only want this overlay on the table, and not on other tabs.
What is the best way to do this? My current solution is a loading view that appears for the table when it appears, or when there is a change in reachability and this loading view disappears on viewdiddissapear. I like being able to put a semi-transparent loading view on top of the table so you can see the old data I guess....
Are there better/alternate ways to do this?
My recommendation is using an activity indicator with a transparent background.
Here is a complete tutorial and sample code (from Jeff LaMarche).
http://iphonedevelopment.blogspot.com/2010_02_01_archive.html
I am new to iphone development. I have to develop an iphone application which is basically a questionare. When user runs the application he has to answer around 30 questions, each one at a time. I am planning to use the Navigation template project for this application. Where i can create a view with question and optional answers (in table view) and when user selects an answer, i can push new instance of same view to navigational controller.
Is the the best practice for creating a questionare application. Or a better template exists? Is it advisable to store 30 instances of a view in view controller stack?
regards
sandy
The navigation template is fine. However, I would do it in a slightly different way, mimicking a wizard.
Your initial root view controller should present the first question, when the user selects it, you push on the stack a new view controller in charge of handling the answer. When the user answer the question, you pop the view controller notifying your root view controller. You may do this using a protocol and a delegate or using a notification. Upon receiving the notification, or when the delegate method is called, the root view controller prepares the next question.
Repeat this cycle until the user answer the last question, then your root view controller presents to the user the final result.
I created a project using the default tab-controller project. I am using interface builder to edit the .xib file and add images and buttons. I hook them up to the FirstViewController object in interface builder (that I created and set it's class to the same as the code file). I hooked everything up using IBoutlets and IBActions.
Everything was working fine, but then I made some changes in interface builder (added a UILabel) and now a method that is run when clicked (I ran through it with the debugger) has a line that adds a subview to the view controller, and it acts as if it wasn't executed. The method (and code is run through) is executed with no errors (per the debugger) but the view is simply not being added. This happened after I made some change via interface builder.
Now, if I hook-up my button to "Selected First View Controller" by clicking on the appropriate tab and dragging the IBOutlet to the UILabel, that label now has multiple referencing outlets. Now, if I do the same thing for the button, the method (the IBAction) is executed twice but the subview is actually added and displayed. But, I get a memory access error because my IBAction (button) method access a property that stores something. I am guessing this has to do with somehow creating the memory in the First View Controller but trying to access it in the Selected First View Controller? If that makes any sense?
I have no idea why this is happening and why it just the button suddenly stopped working. I tried to explain this problem the best I could, it is sort of confusing. But if anyone has any tips or ideas I would love to hear what you guys think about this problem and how to solve it.
Are you sure the first outlet is actually hooked up. If you name an outlet such that it conflicts with some other property that is set while the nib is loading (via initWithCoder:) it can cause things to not end up being hooked up properly. You can check that by NSLog'ing out the value of the outlets in your awakeFromNib.
It also sounds - and feel free to correct me if I'm mistaken - that you're attaching actions in the view loaded by the tab bar to the tab bar's controller. The two entities are quite different and any data that you wish to access from the view should be referenced from the view's controller rather than the tab bar's controller (which should have a fairly light-weight job in loading and unloading your other view controllers). Similarly, you should not be adding a subview to the view controller, it has no idea about what to do with a subview - you should be using the view controller to add a subview to your view. While it seems like a matter of semantics a view controller is fundamentally different from a view. The former has the job of managing the contents and behaviors of a view and to respond to the view's actions where necessarily while the latter is simply a mechanism for displaying thing son the screen.