I've been working on a personal project for a while now, and I'd like to make it enjoyable on iPad, or at least better than currently.
My app consist of three tabs embedded in a UITabbarController with one of them being a UITableViewController. That tableView presents a list of medication, with the possibility to search them with a search bar at the top. When clicking one of the medication we're taken to another viewController using a segue that shows all informations about it.
(I am using storyBoard for this project)
My question is, how can I move from what I have already done to using a UISplitViewController? I mean do I have to re start all my controllers? I don't understand how to start, or where to start?
Should I start with a brand new UISplitViewController and copy/past the code I've already written and then adapt it? Or should I make changes to my actual viewControllers in order to "convert" them to UISplitViewController?
I've been using Swift for around 6 months, I have never used a UISplitViewController as of today.
Thanks in advance for your time and advices, Baptiste FAURE.
PS. Do I need to add any images or part of my code?
Related
The app I am currently working on requires that I do not use ANY storyboards. Therefore I need to do everything programmatically. One thing I seem to be struggling with is switching between two UIViewControllers.
The issue is that every time I call the self.present() method; it creates a brand new instance of the class I would like to show. So when I go into Xcode's visual debugger, I see over 15 different views that are all stacked and are merely instantiations of one another. Ex: View1, View2, View1, View2, View1, View2, View1... This constant repetition of the views is significantly hurting the performance of my app. So my question:
Is there a way that I can switch between my two UIViewControllers without constantly creating a new instance of each one?
Again, I am doing all of this with ALL storyboards DELETED. So the solution I necessary needs to be implemented using ONLY code.
I think you should create main ViewController.
if you keep your two instance view controller, create two controller in mainViewController. Then keep that in main viewController.
And push view controller you want to present in navigation of main view controller
if you want to change second view controller pop navigation controller and push another, or just push other controller.
if you want keep your instance view controller i think it's best option for you
I think that it is really important to realize the fact that the view controller will show up multiple times in the debugger because that is something that can throw off the performance of the app. I really like the way you mention that in your comment. This is one of the main differences that can outstand you from another programmer in the same field. One of the most easiest and simple ways to fix this problem would be using the self.dismiss() method. Another way to dismiss this view controller would be to use a navigation controller to fix this problem. A navigation controller will push the main view controller out of the way and it will not create multiple instances of it. This will be the most efficient as it doesn't require a lot of code and a mere initialization of the UINavigationController class implemented in the UIKit. This is one of the most important tools and resources that you must make use of while coding in xcode and developing your skills in the swift ios field. Since this problem is not one of the most common to find on the internet, it is very beneficial for you to post it on this forum page and will really be helpful for some other programmers unaware of such methods and ways to code. One of the questions that I have for you is the fact that you don't want to use storyboards. Why don't you want to use storyboards and only make it proGrAMitcally? This is one of the very questions that manages to astound me. The storyboard is an implementation that makes it very easy for xcode and swift users to work around the tedious work that has to be done while working in the coding aspect. It only takes a few lines of code and you can get a seGu done very easily. The switch is very easily done and you can find this method on some youtube channels. For this type of work, I recommend VigneshSriniswami Patel and ShaniLakshmiVishnuJiSwami, these content creators will help guide you to becoming an xcode master.
Hope I helped!
I'm trying to make my first Xamarin iPhone app. I have 2 views right now and i'm not sure how to be wire it up and then switch to the 2nd one.
AuthenticationViewController. This is a simple login/create account view.
TabbedViewController. A few sub views all connected by a tab controller. eg. listview, settings and about/info.
right now, i'm setting the root = new AuthenticationViewController and that works fine. just not sure how to swap roots and if this is the correct way to do things.
or should this all be done with a storyboard (which i think is an overkill, here)?
The user should always understand where he is. For that Apple suggests animations removing old content and showing new content. One possibility is the UINavigationController. You can create an empty UINavigationController with your AuthenticationViewController as Root. When the authentication succeeded, you can push your new ViewController (which is the TabbedViewController) on the stack. If you have a log-off in your TabbedViewController, you come back by PopViewController.
The other alternative is the PresentModalViewController. In the appearing controller you define the modal transitions style. This can be anything and especially for this a FlipView-Animation is in my opinion not a bad choice.
All this exists in Xamarin like in iOS.
StoryBoard is doing the same thing but visualizes what should happen underneath. (like InterfaceBuilder for the ViewController itself).
At least in objective-c you can change the root view controller of the window without problems. The only drawback is that you cannot apply transitions doing things this way. But it is totally fine to do so.
I have a few simple apps that are single view. I want to add a 'Info' tab for some instructions, support details, etc.
What is the easiest way to do this? Create new Tabbed Apps and copy the existing code in, or edit the current single view apps? I would prefer if the latter was possible.
Thanks.
I achieved the same in <5 seconds with the below xCode menu option: Tab Bar Controller.
I kept my ViewController classes so my main.storyboard looked like this:
Without understanding more about your current setup your question can't really be answered with any kind of accuracy.
Having said that it's easy enough to add a UITabBarController to an existing app, really all you need to do is change the initial view controller.
I presume you haven't tried searching for an example...
Implementing UITabBarController in code: http://simplecode.me/2011/12/05/tab-based-ios-apps-uitabbarcontroller/
Storyboards: http://mobile.tutsplus.com/tutorials/iphone/ios-quick-tip-creating-a-uitabbar-application-with-storyboards/
I'm at a point in the development of the app I'm working on where in order to complete the assignments given to me, it seems like the best way to accomplish what I need is to combine a UINavigationController with a UITabBarController.
Structurally, the app has a home page, and the rest of the app is navigated through the UITabBarController. This is a sound design for the original, but when I took over the development process of this, I had to make a lot of additions to the app, and there's technically supposed to be a "second" section which adds extra "features" if you will that aren't necessarily related to the main functionality of the app itself.
Basically, since everything begins at the Overview, the user is supposed to have a choice between just diving into the app itself, or using some of these extra features. I'm thinking the Navigation Controller would be fitting for the extra features, but I'm not sure how I can add to it.
What I need to know is - is this solution to the problem sound? If so, what's a good way to accomplish this? Is it ok to have a separate UIWindow class to link the Navigation Controller up with the TabBar Controller?
Granted, this app has used a lot of nib files, and every time I've tried to do something programmatically, it just hasn't worked. Thus, if someone could point out a NIB method of achieving this, I'd appreciate it.
According to Apple recommendation, UITabBarController should always be the root view controller of your app. So basically your main view is just one tab of your tab view controller, and so you just need to embed your main view controller in a navigation controller. This way you can navigate to whatever page you wish within that tab using the navigation controller, or you can go to other tabs using the tabbar controller.
I'm trying to create an iOS 5 application with a SplitView Controller that uses multiple detailviews. Here's the rub. I'm trying to do it using Storyboards. I've found a number of tutorials explaining how to do it in previous versions of Xcode, but none addressing Storyboards.
The one exception creates a tab bar controller in the master view, which is not something I want to use. I tried removing the tab bar and modifying the code but was unsuccessful.
I did figure out that I could attach a replace Segue to a static cell in the master view. It allows me to specify the type as a detail split, which accomplishes most of what I'm trying to do. It loads the new detail controller.
However, the button that shows the master popover disappears during he transition. I believe I can probably prevent that from happening using this method:
(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
Unfortunately, I'm not sure exactly what code to place there to prevent the button from disappearing. Do I need each detail controller as a delegate to the master somehow?
Has anyone gotten multiple detail views to work using storyboards and if so can you point me in the direction of a good tutorial? Thank you so much for the help!
I faced a similar situation and checked the link to the raywenderlich.com. However I found managing the splitview delegate kind of too complicated, and it makes reuse between iPhone and iPad difficult. My solution is to create a DetailedContainerViewController as the right side view controller. And add the view controllers to be displayed on the right side as the child view controllers of the container controller. In this way only the DetailedContainerViewController needs to implement the SplitView delegate. So there is no need to worry about the delegate.
Take a look at the sample code I wrote on github:
https://github.com/raoying/SplitView-Sample