I am running into a weird issue with a custom UINavigationItem disappearing when I push a viewcontroller. Here's my setup:
RootViewController is UITabController
UITabController
Tab1->CustomNavController->ViewController1
Tab2->CustomNavController->ViewController2
Tab3->CustomNavController->ViewController3
I have a custom UINavigationItem (with rightBarButtonItems) that I push on to the CustomNavController for all the tabs. Everything works fine with the first level view controllers on the tabs.
The problem occurs when I push a new ViewController (say VC4) on to a ViewController (say ViewController3) - either via a segue push or through pushViewController with a custom nib.
The custom navigation item disappears and the only way I seem to get it back is to customize the self.navigationItem in VC4 - which I don't want to do.
Any ideas and help is greatly appreciated.
Related
I can use navigation without segues (1) but I would like to use it (2).
Performing a segue and navigating back make my app slower ! Because it doesn't dispose destination view when I navigate back. How do you use this segues in a right way ?
/*1) This code ok! But what about segues */
if(_tabbarController==null)
_tabbarController = (UITabBarController)this.Storyboard
.InstantiateViewController ("MainTabbarController");
this.NavigationController.PushViewController (_tabbarController,true);
/*2) If I run this code I get a new instance of UITabbar */
this.PerformSegue("SegueShowDetail",this);
If you're using the Storyboard and a Navigation Controller, the navigation controller should automatically release your view and associated memory with it when it pops off the stack.
For example, if you've got a method that gets called when you push a button to go to another view, you'd have:
[self performSegueWithIdentifier:#"mySegueName" sender:self];
When you click the back button at the top left of your secondary view, this will trigger the navigation controller to dispose of the view.
I have a problem that I've been sitting with all the day. I have a super view which contains UIPageControl and UIScrollView, in this super view. I have created a sub view which contains three images, three labels, and three buttons. Each button has a touch up event. When the button event is triggered the super view will be promoted by a new view. For doing that, I created a segue which connected with super view and new view. Here is the connection code in the super view.
`
<connections>
<outlet property="pageControl" destination="ivy-0Q-UQo" id="rGm-sh-mdE"/>
<outlet property="scrollView" destination="4Yu-Qb-kbF" id="aqY-ou-cv4"/>
<segue destination="zZo-CH-P2Y" kind="push" id="xBU-ZO-u7s"/>
</connections>
`
This piece of code will guarantee the connection between the super view and the new view is okay,
here is the touch up event code.
WelcomeFrameViewController *welcomeFrameVC = [WelcomeFrameViewController alloc]; //super view instance
NSLog(#"=======================");
[welcomeFrameVC performSegueWithIdentifier: #"ForwardToLogin" sender: self];
When I run the program, the compiler complains with
2012-08-20 10:17:02.325 TTRen[2440:f803] ============44===========
2012-08-20 10:17:02.352 TTRen[2440:f803] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver WelcomeFrameViewController: 0x688e960 has no segue with identifier 'ForwardToLogin''
I am quite new in iOS, any suggestions will be deeply appreciated.
'Receiver WelcomeFrameViewController: 0x688e960 has no segue with
identifier 'ForwardToLogin''
In your storyboard, check that you actually have a segue named "ForwardToLogin"
There does seem to be a bug with xCode (still in 6) where storyboard changes you make aren't get copied to the simulator. You can reset the Simulator's Content & Settings to resolve this.
Other things to check:
Check the naming of your segue. Check it again. Check it some more :-)
Ensure that your segue is pointing in the right direction. It needs to point away from the UIViewController that calls performSegue….
Ensure you don't have two copies of your view controller on top of each other, with the segue attached to the one on top, and you instantiating the one underneath!
There's a similar question here and I encountered the same problem too. The reset fixed it for me.
I'm using the NativeControls plugin to create a tabbar - http://d.pr/vBJZ
Apparently, on first load, the tabbar has the onSelect event attached to them and i can refresh the webview just fine by doing window.location="http://someremotedomain.com".
But once the webview refreshed with the new external page - it seems the tabbar loses its onSelect event.
I suppose my real question is - why does the tabbar buttons loses its onSelect Event when the webbview starts to show a different (remote/external)page?
Does that mean that i have to re initialize the NativeControls on every new page? that isn't possible because the page im showing is coming from an external source, which doesn't include the phonegaps js related files.
My 2nd question - probably would help me dilemma, is there any way to grab the UIWebView control?
okay nevermind i figured out:
the javascript callback function doesn't exist anymore on the next page
yes you can - but i don't know in the js file but in the plugin/obj-c you can access the webview
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.
Hey!
Have a problem that is driving me crazy! My Main Window will not change when a make changes in interface builder in xcode 4, I have played around for over 2 hours trying to make changes but when a build it does not change. When a change something in the code it works just fine.
The thing I'm trying to add to the main window is a new tab in the tabbar.
Please help me !
UPDATE:
My applictiondidfinfishwithoptions looks like this.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[window addSubview:navigationController.view];
[window addSubview:tabBarController.view];
[self.window makeKeyAndVisible];
return YES;
}
Make sure that you are adding the tab to whatever view is assigned to the main window's root view controller property. If you drag and item into the window itself it won't work. To complicate matters, some of Apple's templates configure the root view controller in the application delegate's application:didFinishLaunchingWithOptions: method, so check there to see what is being assigned.
UPDATE:
You should add one view to the window and add the other views as subviews.