setting the title of a barButtonItem in the detailView of a splitViewController - uisplitviewcontroller

I am a newbie at iOS and an struggling with something related to with a split view controller.
I have a split view controller where the master is a navigationController, containing a tabBarController. The tabBarController has two tabs, each pointing to TableViewControllers in it's own navigationControllers.The detail view of the splitView is the splitViewDelegate.
The part where I am struggling is in the
splitViewController-willHideViewController-withBarButtonItem-forPopoverController.
I want to set the title of the barButtomItem based on the title displayed in the master.
I would appreciate if anyone can help me figure this and maybe understand the missing pieces in the process.
thanks

Here is the code used to access the title of the master using the default split view controller project:
UINavigationController *nav = [[self.splitViewController viewControllers] objectAtIndex:0];
MasterViewController *master = (MasterViewController *)[nav topViewController];
barButtonItem.title = master.title;

Related

how to mention a target blank in grid view. how to add target blank in action page

How to mention a target _blank in symfony action page?
$myRowAction = new RowAction('View', 'viewinvoice');
$grid->addRowAction($myRowAction);
If i click a (view) in grid page, the data display in new window.
Seem you are using the APY/APYDataGridBundle. Reading the doc here specify how to define the target of your link: is the 4th parameters of the constructor. As Example:
$myRowAction = new RowAction('View', 'viewinvoice', false, '_blank');
$grid->addRowAction($myRowAction);
Hope this help
For the future, please mention which library/framework are you using and what you tried. Take care to use the correct tag also (this issue is not about sf1.4)

How navigate to next page using AJAX in MVC4?

I don't have so much experience using AJAX in a MVC application, in fact is my first facing. Please check the below image and note the rectangles.
The image is just an example that I took from internet.
The biggest rectangle is a partial view in my application and I have to render it when the user press Continue or Continuar button. The application should replace the current view for another without refresh the page.
This is the code which I'm testing, note first that I'm passing the first element of a list, but when the user press the button, render the view with the next element index = 2.
public ActionResult DoTest()
{
if (!Request.IsAjaxRequest())
{ }
List<Worksheet> worksheets = new List<Worksheet>()
{
new Worksheet("Hoja 1", ...),
new Worksheet("Hoja 2", ...)
};
return View(worksheets[0]);
}
Can orient me a little bit to know how to implement this feature? I just know that I need to use Ajax.
Have a look through the tutorials and examples here. There's plenty of other material around on the web with information on this subject.
There are many different ways you can achieve this. One way would be to write a custom paging Helper (HtmlHelper) that accepts new content upon the post event. You can view all about Helpers here : Custom HTML Helpers
Another way could be to use partial page rendering to achieve the partial page update upon post event.
If I was you I would combine a partial view with a jquery function to update the content. You can view some help on that here: Change dive content with Jquery

MvvmCross UINavigationController customise navigationBar

Further to my experiences with MvvmCross, I've managed to build an app for iPhone which starts with a TabBarController. I can also successfully navigate within each tab to deeper levels. The problems start when I want to customise the navigationBar on the deeper levels - setting the backButton colours, etc. The code I use for navigation is the standard viewModel code -
this.RequestNavigate<InJourneyViewModel>();
…which works fine, but I can't do anything to the navigated-to view's navBar, other than set its title.
Any thoughts or advice appreciated!
I think it might help if you posted some more of your code that is failing.
My suspicion is that the problem is a more generic Cocoa, MonoTouch and/or backbarbutton problem.
I've just played with the ViewDidLoad code in MapView.cs in https://github.com/slodge/MvvmCross/tree/master/Sample%20-%20CirriousConference/Cirrious.Conference.UI.Touch
At the end of this, I was able to add some bar button changes like:
var leftButton = new UIBarButtonItem("FooBar", UIBarButtonItemStyle.Bordered, null);
leftButton.TintColor = UIColor.Green;
NavigationItem.SetLeftBarButtonItem(leftButton, false);
NavigationItem.RightBarButtonItem.TintColor = UIColor.Red;
Which resulted in:
Alternatively, by placing code in the WelcomeView:
var leftButton = new UIBarButtonItem("FooBar", UIBarButtonItemStyle.Bordered, null);
leftButton.TintColor = UIColor.Green;
NavigationItem.BackBarButton = leftButton;
Then I succeed in achieving:
Alternatively, by using code like:
UIBarButtonItem.AppearanceWhenContainedIn(typeof(UINavigationBar)).TintColor = UIColor.Blue;
Then this enabled me to customise all the navigation bar buttons like:
At one point, I also managed to achieve:
... but sadly I've genuinely no idea which code combo gave me that! If your problem is with back buttons in particular, then I think you will need to dig around other questions and/or post some code and hope someone can help - there's lots of posts about how to do this, but I can't quite figure out what they all mean for MonoTouch - e.g. Separate title in NavigationBar and navigation buttons

Why is self.navigationController = nil from a method

For some unknown reason I cannot push a view, I will try to explain the best I can but i have alot of complicated views going on, And it would be a nightmare to explain but say I have the following method.
-(void)showDetailView{
DetailViewController *detailView = [[DetailViewController alloc] initWithNibName:#"DetailViewController" bundle:nil];
[self.navigationController pushViewController:detailView animated:YES];
[detailView release];
}
Which works and would push the detail view onto the stack, this is on my main view and my main thread.
So in the table view i have a cell with a Subview that then takes its view from another view controller. In that view controller I have more subviews, and say when a user clicks a subview a method is called. Which in turn will call this method on the mainView.
So one would believe that then a new view should get pushed. And the code runs, no errors occur but the view is not changed/switched.
I have tried various method of pushing a view inside the view controller that is it called from. and then just calling a method which is directly connected to the navigation controller to push the views.
A few things to add.
1. I have a IBAaction button that pushes a view (that works fine)
2. I assume its because im through so many views but I'm assuming that if you call push view controller it will push whatever view you pass it.
3. I have checked when the method is called from the main view self.navigationcontroller does not = null.
But if the navigation controller is called through the method call it = null.
So is there anyway to restore the null value of a navigation controller?
Im a little confused on why i cant simply call a method to push a view
Thanks
Its ok I have sorted it now
In terms of how i solved accessing the superior superview to my view is
An ID tag to the views superview which is the cell that my subview is in
id CellController = [self.view.superview.superview nextResponder];
[CellController performSelector:#selector(showDetailView:) withObject:Link];
Then calling a method in my cell which then in turn access its superview
id mainController = [self.view.superview.superview nextResponder];
[mainController performSelector:#selector(showDetailView:) withObject:Link];
Which then the main still retains its navigation controller and then in the show detail method in the main passes the link and pushes the new view.
Basically the total superview of a subview can be no higher then wherever it was created. So the subview in my cell could never access and run anything through my mainView properly, i could stuff but it never performed how it should be. So accessing its highest level superview and then getting that to access its superview as the cell is in my main view then I could run methods correctly.
Hope this makes sense only getting my head around it all.
Thanks to -> How does one access a super's view controller?
For the Id tag bit, not used Id in this way so another things learnt
I just had nearly the same problem today. If the navigation bar is hidden when you push a view, you may have a nil navigation controller. I resolve the problem like this :
self.navigationController.navigationBarHidden = NO; // So the navigation controller is not nil
[self.navigationController pushViewController:articleInfoController animated:YES];

How to setup UISplitView with a navigation controller in the detail view

So just went through this tutorial:
http://icodeblog.com/2010/04/05/ipad-programming-tutorial-hello-world/
Now what I want to do is setup the detail view as a navigation controller. The question is how?
My first inclination is to have the DetailViewController extend a UINavigationContoller. Is that the best approach? If so does the array of controllers go into the DetailViewController?
Comments, ideas, tutorials are all welcome. Thank you.
Yes, chaitanya is right; You can add navigation controller to split view from xib or you can create split view programmitically, like:
self.rootViewController=[[RootViewController alloc]init];
self.detailViewController=[[FirstDetailViewController alloc]init];
UINavigationController *rootNav=[[UINavigationController alloc]initWithRootViewController:rootViewController];
UINavigationController *detailNav=[[UINavigationController alloc]initWithRootViewController:detailViewController];
self.splitViewController.viewControllers=[NSArray arrayWithObjects:rootNav,detailNav,nil];
self.splitViewController.delegate=self.detailViewController;
so now your will have navigation controller in detail view.
You can download the working code here.
The solution:
http://kshitizghimire.com.np/uisplitviewcontroller-multipledetailviews-with-navigation-controller/
the better approach would be adding a navigation controller for the detail view in interface nib just like how we will add for root view contrller.

Resources