This is what I want to do but not sure if it could be done.
my first view contains 3 buttons.
When this view is displayed, I need to present a ModalPopup for the login.
When the authenfication is done, the user can tap on one of the 3 buttons.
When the button is taped, I need to switch this view to a TabBarController and active the correct TabBarItem regarding the button.
Most of the TabBarItems can contain a SplitViewController.
I read several posts and tutorial about the SplitViewController but most of them show how to run a splitViewController from the appDelegate controller.
Then my first question would be.. is it possible :-)
The second one, would be, how?
Thanks...
Mortoc is correct about UISplitViewController needing to be the root controller.
You can use MGSplitViewController as a drop-in replacement for UISplitViewController - and it doesn't have this limitation.
It sounds as if your hierarchy might be something like
UINavigationController (root)
UIViewController (3 buttons)
UITabBarController
MGSplitViewController (1)
MGSplitViewController (n)
Sorry, you'll have to roll your own SplitViewController equivalent. Apple only supports UISplitViewController as the root view item: it has to be the first view loaded in your application and it's size is fixed.
http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/iPadControllers/iPadControllers.html
Related
Currently in my app I have this design:
-- DialogViewController 1
-----DialogViewController 2
--------DialogViewController 3
-----------TabBarController
--------------DialogViewController4
--------------DialogViewController5
--------------DialogViewController6
--------------DialogViewController7
Problem with this is that dialog view controllers 4-7 breaks the monotouch dialog flow (so to speak), because of TabBarController in between. When I create dialog view controllers 4-7 I need to create new Root in their constructors which I don't need to for DVC 1-3.
With this approach certain things like radio groups don't work inside DVC 4-7 e.g it will display the radio group selection, but there is no navigation bar at the top.
My question is what can I do to solve this? Can I use TabBarController inside DVC somehow if that makes sense? Or how can I "hook" DVC 4-7 back to main "circuit"?
Thanks in advance.
According to the iOS HIG
A tab bar appears at the bottom edge of the screen and should be
accessible from every location in the app
which implies that it should be the root, not nested inside another controller.
Forgive me if this has been asked/answered already but I couldn't find it anywhere (at least no in Monotouch - vaguely answer for ObjC. So completely new to Monotouch but I have everything completed in my application that I want with one exception. I'm trying to update a parent of a subview.
Here is the scenario:
I have a UINavigationController with a UIView (not a table) which has a few buttons on it that directs via a PushViewController to a Subview. I make some changes on the subview, which I would like reflected back on the parent. I can of course add a manual refresh button if I wanted but was looking for something a little better.
I did see some things that referred to using a viewWillAppear but couldn't find any good examples. My attempts failed pretty bad, so any suggestions would be great.
Thanks,
Richard
If you have a UINavigationController, it has a "back" button on top. Once this is hit by the user (or if you pop to a previous view controller), the currently view controller shown will trigger ViewWillDisappear and ViewDidDisappear and the view below (the one with your buttons) will fire ViewWillAppear and ViewDidAppear. Just overload those and update your UI state in there.
I'm trying to accomplish switching views without using a navigation controller, tab bar controller etc. I am currently accomplishing this using Cocos2d director class replaceScene method. My application will need to have around 40 view controllers, each with a few UIButtons that could take them to any other view controller.
For instance View controller 1 may have buttons that take you to view controller 2
View Controller 2 may have buttons that link to 3,4,5,12
view controller 4 may need to link to view controller 17, 5 and 3
Every tutorial and bit of documentation I've read only discusses using Navigation Controllers, Tab bars or pushing views modally. None of these solutions fits my particular requirements.
Cocos2d has the "replaceScene" method which does exactly what I need, but mixing the many UIKit controls that I need makes developing this entire project in Cocos2d a nightmare.
I'm looking for something where I can have the user tap a button which will load a specified view controller/view transition to that view, and unload the previous view controller from memory. Any ideas?
Have a root view controller which has references of your view controllers. Also make a weak reference to the root view controller in each view controller, as in a delegate pattern. If one of the view controllers wants to make a view transition, send a message to the root view controller. Let the root view controller hide the current view and unhide the next view, using an animation if you want.
Basically you are implementing a view container much simpler than UINavigationController and UITabBarController. You could probably achieve the same thing using the tab bar controller and hide the tab bar view, but I would implement a custom one.
my question is about view controllers, delegates and all that in general. I feel perfectly comfortable with UIView, UIViewController, Delegates and Sources, like UITableView does for instance. It all makes sense.
Now I have implemented my first real custom view. No XIBs involved. It is an autocomplete address picker very much like in the Mail application. It creates those blue buttons whenever a recipient is added and has all the keyboard support like the original.
It subclasses UIView. There is no controller, no delegate, no source. I wonder if I should have either one of those? Or all, to make it a clean implementation.
I just cannot put my finger on the sense a view controller would make in my case. My custom view acts much like a control and a UIButton doesn't have a controller either.
What would it control in my view's case?
Some of my thoughts:
For the source: currently the view has a property "PossibleAutocompleteRecipients" which contains the addresses it autocompletes. I guess this would be a candidate for a "source" implementation. But is that really worth it? I would rather pass the controller to the view and put the property into the controller.
The selected recipients can be retrieved using a "SelectedRecipients" property. But views should not store values, I learned. Where would that go? Into the controller?
What about all the properties like "AllowSelectionFromAddressBook"? Again, if I compare with UIButton, these properties are similar to the button's "Secure" property. So they are allowed to be in the view.
The delegate could have methods like "WillAddRecipient", "WillRemoveRecipient" and so on and the user could return TRUE/FALSE to prevent the action from happening. Correct?
Should I maybe inherit from UIControl in the first place and not from UIView?
And last but not least: my custom view rotates perfectly if the device is rotated. Why don't all views? Why do some need a controller which implements ShouldAutoRotateToDeviceOrientation()?
Does it make sense what I wrote above? In the end I will provide the source on my website because it took me some time to implement it and I would like to share it as I have not found a similar implementaion of the Mail-App-like autocomplete control in MonoTouch.
I just want to learn and understand as much as possible and include it in the source.
René
I can answer part of your question.
I just cannot put my finger on the
sense a view controller would make in
my case
The ViewController is responsible for handling the View's state transitions (load, appear, rotate, etc) These transitions are used mainly when you use a navigation component (UINavigationViewController, UITabBarController). These components needs to received a ViewController that will handles the view's transitions.
For exemple, when you push a ViewController on a UINavigationViewController, it will cause the ViewDidLoad, ViewWillAppear, ViewDidAppear. It will also cause the ViewWillDisappear, ViewDidDisappear of the current ViewController.
So, if your application has only one portrait view, you don't need a ViewController. You can add your custom view as a subview of the main window.
How can I arrange (programatically) the back button of a UINavigationController in a different position?
For example, suppose that the back button (visible in the upper bar of a UINavigationController) has these coordinates: 67 for x and 10 for y. I would arrange the back button for these coordinates: 89 for x and 10 for y.
Do I have to override these measures in a specific method (for example viewDidLoad() method)?
Thank you. Regards.
I guess this cannot be done in a simple way as you can manipulate the navigation bar only via few properties. So there are basically two methods:
1) traverse the UI tree and search for the actual button control created by iOS for you in the navigation toolbar and change its Frame property. You can always get to the inner controls by the Subviews property, so call navigationController.Subviews and iterate through that until you find the control you would like to move, btw it could be deep in the hierarchy, depends. And with iOS update this can change, so this is a bit of a hack, but usually such technique works well.
2) do the custom way. Hide the actual navigation bar, and do the navigation yourself via custom buttons, add a UIButton to your interface, in the action for that call popViewController on the navigationController. If you're inside a view controller, you can use this.navigationController.PopViewControllerAnimated (...);
If you need nice buttons, use this PSD, works well for me http://www.teehanlax.com/blog/2010/06/14/iphone-gui-psd-v4/
Hope this helps. If so, please vote.