Set uibarbuttonitem from child view - ios

I have a parent view controller and a child table view controller each embedded in a navigation view controller. It looks like so:
I want to make it so when I click the button Done, the Next button is enabled. I have tried to use [self.view setNeedsDisplay] but no luck, tried other things such as setting vc.nextButton.isEnable = True but nope. I've been working on this for a few hours with no avail. Please explain your solution as well.
Here is the whole thing

Related

Animation on Xcode 7 on my view controller would only work if i set the view controller as initial view controller

i was making the animation for my app, but if the view controller which i am working my animations on is not set to initial view controller then the animation would not work. I wont to access this view controller by pressing a button on the view controller before. The animations on the first view controller (initial view controller) work but not on any other view controllers. Thank you in Advance
i found the solution. To fix it i needed to add a navigation controller in the beginning, and to make it disappear when i review my app i type
self.navigationController?.navigationBarHidden = true
now i have another question, how can i hide the navigation controller from the storyboard when i edit the view controller, because it is getting in the way and messing my auto layout constraints. Thanks

How navigation bar behaves during popViewControllerAnimated?

I have a problem durning animation of popViewControllerAnimated
There are 2 view controllers, first one has navigation controller already pushed.
I'm pushing 1 controller to 2nd controller and I'm creating custom backButtonItem with custom method which includes popViewControllerAnimated. And then 3 strange dots appear as in the image below:
What could have happen so those 3 dots appear?
It seems that you use:
self.navigationItem.hidesBackButton = YES;
somewhere in your view controllers.
If you create custom back button you shouldn't touch this property. Otherwise three dots appear while you animate between view controllers.
If it won't help you, please provide source code of how you create your custom button.

UIActivityIndicator not appearing in Search View Controller

I have a UIActivityIndicator set up in storyboard like so
I have checked that the IBOutlet is set up properly, but the view still doesn't appear.
I've tried adding the following, but no change.
_spinner.hidden = NO;
[self.view bringSubviewToFront:_spinner];
_spinner.center = self.view.center;
[_spinner startAnimating];
I also tried adding the ActivityIndicator as a subview of the Search View Controller, but Storyboard wouldn't let me.
Also strange is that when I tried hiding the tableview before showing the spinner, the corresponding portion of the screen was black.
Put the code above in ViewDidLoad. And make sure animating property in the interface builder is turned on.
While seeing your image..
I think the search view controller is hiding the activity indicator view.
So, Keep the activity indicator view on top of table view of search view controller or
on top of search view controller at Interface Builder..
Hope it helps you..
If still not fixed..Please post entire code where you initialized activity indicator view at your implementation..(.m)

Bypass UIView without showing

I am using Storyboards for an iOS 7 App. The root controller is a menu. For almost every view, I have a Menu button which brings the App back to that menu using [self.navigationController popToRootController:TRUE]. However, there are two UIView elements where I would like to clear the Navigation Controller view list (as happens when you pop back to the root controller), but then immediately go to another UIView without having the user see the root controller's view. Once at this new view, if the user presses the back button, I want them to go to the menu view.
I've tried to put a performSegue in the viewWillAppear, but it really messes up the Navigation Controller and views. I've tried putting a performSegue in the viewDidAppear, but the user sees first the Menu view flash in, then out on it's way to the correct view.
I hope I've explained this well enough. I hope this can be done.
Thanks.
Your best bet is to build the navigation controller stack yourself, and then use - (void)setViewControllers:(NSArray *)viewControllers animated:(BOOL)animated: to replace the current stack.
So you could do something like
...
UIViewController *vcToPush = ...;
NSArray *newVCStack = #[[self.navigationController.viewControllers firstObject], vcToPush];
[self.navigationController setViewControllers:newVCStack animated:YES];
This will add your new controller to the stack using the standard push animation (or not if you so choose), and after the animation is complete, set the view stack to that of the array.

Using splitviewcontroller with storyboards?

I have created a splitview controller in a storyboard that has a navigation bar across the top. I also have a master view with a tableview that when selected displays the correct view in the detail view controller.
How can I update the splitview controller's navigation bar title? I know I can access the master's nav bar through "self.navigationItem.rightBarButtonItem" but how do I access the main nav bar from this file?
Thanks
If you have a navigation bar across the top, then you can set the title like this:
self.title = #"this is my title";
If your title is fixed and doesn't change, then just add that line in your viewDidLoad method or where ever you would setup items in your view.
If you are trying to set the title programmatically, then it depends on which view controller you are in when you try to set the title. In the example above, it will set it for the view controller you are in.
If you want to set the opposite view controller navigation bar, you have a couple of ways to choose from depending on when you want to update it.
Generally though you would reference the opposite view controller directly using a delegate or indirectly using the splitViewController.viewControllers array.
it sounds like you already have a reference to the detail view controller. If so and you want to change its title from the master you can do so like this:
[self.detailViewController setTitle:#"New Title"];
hope that helps,
be well

Resources