iOS5: Relationship Segues and Tabs without using UITabBar - xcode

TL:DR - How do I create Relationship Segues in Xcode 4.4?
Hello everyone, I have an app where I want to add some tabbing behaviour to one of my controllers but, due to design decisions, I can't use UITabbar. I already know about using a UIToolbar with a UISegmented control inside it, but where I'm having difficulty, is how to switch between view controllers.
I know I can't use normal segues (since each tab change would keep stacking a new controller on top of the previous), but UITabBar has something called "Relationship Segues". I looked around but couldn't figure out how to create one.
Does anyone know how do it? Also, is there a better way to approach this problem?
Thanks

I've done the exact same thing recently. I've created a container view controller, SegmentedViewController, and added the view controllers I wanted to switch between to my container controller using addChildViewController. Upon switching view controller (I used target/action on my UISegmentedControl), you call transitionFromViewController:toViewController:duration:options:animation:completion. That's the general idea. Look at the "Implementing a Container View Controller" section here for implementation details.

Related

Using container view with Xamarin and MVVMCross

I am trying to use a Container View within a View Controller (Free Form View) to reuse some components that are common for two views. So far I have a View Controller (Free Form View) with a Ui View and a Container View. Upon opening up the Free Form View, Container View should contain Free Form Purchase View, but when pressing the blue Button, that View should be replaced with the View last View Controller. I have a similar setup for Android where I use Fragments.
I am looking for the best way to navigate between the controllers. I use MVVMCross throughout the application, but I am open to other suggestions that does not involve MVVMCross.
you need to create your own controller which handles swapping of Views in Container View through custom Segue implementation.
You can find detailed step how to do this from Richard Woollcott post: Using the ContainerView to Transition between Views - aka More Fragments in Xamarin.iOS

UIAppearanceCustomizableClassInfo tableView:numberOfRowsInSection

I have a view controller containing table view. In particular scenario I am re - initiating the view controller. In that case I am getting this error.
UItabelViewWrapperView tableView:numberOfRowsInSection
Note: My code is perfectly runing on ios 7. It keeps getting crash in ios 8.
I had the same problem. On my end, the problem was appearing when the view controller was popping to its root, navigating to the new views controller that I wanter and finally go back to the very first view controller (that was on another tab). So the solution for me was to remove the popToRootViewController method. That worked for me. I don't know your code in detail so I can't provide you a better solution or opinions.
I hope that helps.
n.b.: I am doing the navigation from AppDelegate.

Should I concern the close of controller in Marionette?

Let's use an example of a blog built by Marionett. The blog post is a sub app and hook the route post/:id. It also has a controller, inherited from Marionette.Controller. Quite normal.
Each hit to post/:id will create a new controller instance, managing the related model and views. The controller instance will trigger App.vents but won't listen on App.vents.
My question is, since there will be so many instances of the controller created when an user navigates around, should I concern the close of the instances when there are a close() method available in controller? Will there be memory leak if not closing them?
Thanks.
There could be a memory leak depending on what's inside your controllers. Also if you're controller is using listenTo to watch events on other models/objects you could get a build up of zombie events. Without seeing your code it would be hard to say for sure.
In general, I think why not just close the controllers? The way I do this (from BackboneRails tutorials) is to have the first view controller the renders (typically a layout) as the main view and then bind to the view's close event--when the view closes the controller will call close on itself. You can build this into your base controller so it happens automatically. This has worked pretty well for me...

In a single page desktop-like application, should I dynamically instanciate a controller for a window? How?

I'm asking this because I really don't know where I should handle events of my dynamically created window.
When someone clicks on a desktop icon, the window (if it doesn't exist) will be dynamically created. Should I create a controller when creating the window and hook to it? If yes, how?
Here you can read different approaches I've thought about:
Create a controller that will instanciate the Window (as its view), I will handle everything there
Create the window only and hook everything in my taskbar controller (which is where the window is created). In this case, the Taskbar controller will become very big.
Pre-create all window controllers and eventually windows too and hide them (when page is ready). Then just show/hide them, so I will have "static" references to all controllers with getController in Application
Which approach should I use?
Edit 1:
I'm trying to dynamically instanciate (and reference it through another controller) a controller. I'm having hard time expecially in referencing it. Any suggestion on how it should be done?
I found Ext's MVC unusable with desktop demo as it's possible to have multiple windows (views) of the same type tied to a single controller. Each window has it's own state and it's hard to differentiate between the views in the controller.
I solved the problem by myself: I preinstanciate the controller as I do with all controllers, by inserting them in Application controllers array. After this, I instanciate the view on that controller when a method is called, then I simply use refs to access this view.
The method is quite clean and using refs feel so good. Obviusly the controller has a method hasWindow which checks if the controller view has been created already.

Attach TargetWithoutContext to an AppBarButton

I have a Conductor<MyItem>.Collection.OneActive ViewModel and try to attach the application bar buttons to methods of MyItem with cal:Action.TargetWithoutContext="{ Binding ActiveItem }". My view is a Pivot, if someone wonders why am I trying to attach the application bar to a child ViewModel. The compiler says "Property 'TargetWithoutContext' is not attachable to elements of type 'AppBarButton'." Though it works with normal buttons elsewhere in the view.
How can I get it work? Or maybe any workaround?
The AppBar functionality that Caliburn.Micro provides is a hack due to the flaws in the underlying framework, which doesn't allow arbitrary binding. Unfortunately, we can't support TargetWithoutContext. For AppBars the target will always be the page's view model and messages can only be directed to it. If the page's view model is a conductor, and you want a child to receive the message, you could have the conductor receive it and then forward it on to its ActiveItem.
Unfortunatly the ApplicationBar is not bindalbe as it is not Part of the Silverlight Framework.
You can only interact with the Application via the Code Behind File of the Page which uses the ApplicationBar.
You have to register the Click Event and invoke the Action form the code Behind.
The WP7 ApplicationBar is just a simple wrapper around the native shell and doesn't support data binding at all. However, there are a couple of workarounds available.
http://caliburnmicro.codeplex.com/discussions/232742

Resources