I am following a tutorial video on how to allow users to edit their profile. In this tutorial, they are using storyboards and I am not. I was wondering, do I have to use storyboards in order to follow along? Or can I use their code to plug into mine without the storyboard?
According to Apple documentation:
A storyboard is a visual representation of the user interface of an
iOS application, showing screens of content and the connections
between those screens. A storyboard is composed of a sequence of
scenes, each of which represents a view controller and its views;
scenes are connected by segue objects, which represent a transition
between two view controllers.
As you are probably guessing, storyboards contain information about widgets, animations, views that are required by the code you will be adding to yours. Additionally, Storyboards also contain the connection between the visual elements and the code (outlets and actions). All of that can be created programmatically but the code you will be pasting from this tutorial, if it's coming from a project that includes storyboards, won't contain this associated logic.
So, at this point, it would seem highly unwise to add complexity to your tutorial to recreate these elements at once. What I would suggest is for you to follow the tutorial and then try to remove some of these elements and replace them by code to obtain similar results just as an exercise to learn. Keep in mind that Storyboards have been around to simplify the design of UI in the application, so I would recommend for you to master their usage instead of shying away from them.
Related
This is a best-practices question.
When one makes a new Swift application for OSX, it builds a Main.storyboard and places that physically in the Base.lproj folder, but logically within the app's main "group".
I decided to separate different parts of the UI into different storyboards, so I added a Document.storyboard and Preferences.storyboard.
In retrospect it's not clear if this was the correct way to do this - for items that consist of a single window or view, should I use storyboards or just use XIBs? I've read the Apple documents but I'm not clear on the practical differences. Are storyboards "replacing" XIBs, are they the new hotness that I should use from now on?
Now I will be expanding the project with additional views, specifically a series of sheets used for editing certain features of the document. Should I put these all in a single storyboard, one XIB, or individual XIBs? Is there any strong reason to select one over the others?
And finally, when I added my storyboards, it placed them in the root of the project folder. Should these really be moved to Base.lprog?
This is something I've been thinking about, too. I've recently gotten into OS X development, so I'll share my amateur view of XIBs vs storyboards. To those of you that are more familiar with this, feel free to correct me if I'm mistaken.
Interface Builder inside Xcode seems to do a pretty good job of allowing you to put a skeleton in place, but doesn't always provide all the necessary customization options for a view. When using storyboards, I frequently end up with projects that are half visually based, and half code. It's like working on a cyborg.
Nibs/Xibs suffer from the same problem, but they don't even try to implement transitions. From what I can tell, they represent single windows, views, or menu items. This makes them simpler and more modular. You get to write the code that handles the wiring of them together, and, at first, it may seem like more trouble, but it actually feels like a benefit to me because of the level of control gained. Storyboards can do a lot of this for you, but I personally tend to prefer having it all together in the code.
The ideal solution, to me, would be for Apple to implement a more abstract form of user interface design: where each window (or iOS view, depending on the platform) was contained in a nib, and a Storyboard was only a transition mapping between the nibs. For example: You create all your windows and menus, and then use the storyboard to connect them all, but the storyboard can't edit any of the views details, only transitions and connections.
That being said, I'm quickly getting to the point where I prefer nibs and do all the other coding myself. If nothing else, I'm becoming a better programmer for it. Hope this helps!
What is advantage and disadvantage not using storyboard and xib.
I am building an application without using storyboard and xib, what happen if project is build programatically.
Storyboards dont only speed up development, but they also help identify UX issues and get an overview of the current UX of an application.
Software should be built with the future in mind and the storyboard allows an entry point into the project for other developers or designers, as well as yourself, if you for some reason left the project for a while.
Having everything in code or even xib files wastes time, even great documentation is slower to process that a visual layout of the apps UI.
Xibs on their own can cause design issues.
For performance, storyboards are optimized.
Overall as the name suggests, its the visual story or flow for your app. You should also split different functionality of your app into different storyboards e.g. if you have a side menu that loads different view stacks, use different storyboards as needed.
Obviously its not 1 or the other with storyboards and code, it depends on the situation, you might even use a xib here and there. Software is dynamic and new ideas come about, not all have fixed solutions, that would be boring.
Just last week I decided to dive into the world of Swift and Xcode development, and as of yesterday I am actively working on a new application. I have a lot of experience with Java Swing, but working with that is obviously a lot different than working with Apple's fancy interface builders and storyboards.
I am trying to develop a single-window application that has many different views that can be navigated by buttons. I tried to wrap my head around the way the storyboard works, but even after all my reading of the documentation I don't know really what I'm doing - I'm so used to working in hard code. It came to the point where I wrote my app's entire network layer just to avoid working with the interface.
Basically I have a set of different NSViewControllers, each with references to a few of their components (buttons, labels, etc) and I want certain buttons to be able to change the current view controller (preferably with a segue animation) to a different one. How can I approach this? I would guess that this isn't hard to achieve, but I am lost. Any help would be appreciated!
Let me know if I need to submit any code - I do have the basic classes written but nothing relating to this.
Thanks,
-Aidan
I was thinking of games in particular, where there may be alot of views that need to be switched in and out. Could someone supply some sample xcode 4.2 code? Many tutorials have old xcode versions which have different initial code.
Thanks
Most efficient method I would say is usin the story board feature. Set up a new view controller inside the main storyboard file and then control drag from which red button on one view to the next one. Very easy and no code required. Email me if you had any problems dai.evans94#live.co.uk
It seems like there is a lot of online information regarding switching between views in Cocoa Touch, but not that many in "desktop" Cocoa. For an app I am creating, I am wondering the pros/cons of the methods (and please list the methods if you could), and which one people personally use/suggest. I don't think that using an invisible border NSTabView will do the trick for this specific app, but I value all your options. I will be changing the view with some buttons at the side as show in iPhoto, iTunes, and generally most Mac apps out there.
Thanks for any help.
EDIT: I have looked into using NSViewController, but am wondering what advice anyone has about how to use this/why not to use this.
Cathy Shive has created a framework called KTUIKit which was designed with single window applications modeled after iPhoto/iTunes/etc. The KTTabViewController class in particular may be of interest, as it provides a way of switching between an arbitrary number of subviews. They provide a formal way of dealing with nesting views, keeping the responder chain intact, and keeping various notifications properly observed/unobserved. There are also a series of blog posts describing some of the reasoning behind the design and how the classes work (the blog posts refer to them with an "XS" prefix instead of "KT", but they're basically the same thing).
Check out Brandon Walkin's excellent BWToolkit
NSViewController will work fine. I've used it for a very similar situation without any problems.