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)
Related
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
I'm relatively new to iOS Objective-C development, and I've come across a problem that I can't find a solution to.
I have a Table View Controller, with two prototype cells on it, which populate fine. This Table View Controller is one of three Tab Views, and the View that sends to the Tab Views has a Navigation Controller. This means that the views within the Tab Views also have a Navigation bar. The bar works fine, in terms of the "back" button working as expected, and the bar being in position. However, (at least on the List View) the Navigation Bar isn't fully recognised - it's title doesn't appear, and the table cells start directly below the status bar, rather than below the navigation bar.
Here's a couple of screenshots showing the problem:
what appears in Xcode (what I expect to happen)
And then on the device, this is what actually appears - the Back button in place and working fine, but no title field, and the table cells start too high.
I've tried adding Navigation Bar's and Navigation Items, and while adding a Navigation Item allows me to put a title on in Xcode, it still doesn't appear on the device in testing. I also tried to add another Navigation Controller just before this view, but that didn't resolve the issue either, and it caused navigation problems further down in the heirachy.
Hope I've been clear enough, please say if I need to post more information - I'm relatively new to Xcode and so not sure what exactly is applicable and what isn't. Thanks!
please try this code, it might fix your table position
// Since in iOS7 the nav bar is translucent by default, so the table view starts at (0,0)
// you can either disable the translucent, which i don't recommend unless you really want to
// or just add 64 pixel on the top of your table view
[self.YOURTABLEVIEW setContentInset:UIEdgeInsetsMake(64, 0, 0, 0)];
and for the title, please try this
self.tabBarController.navigationItem.title =#"YOUT TITLE NAME";
Hope that helps..
Assuming your hierarchy as
NavigationController -> ViewController -> TabBarController -> ViewController1
-> ViewController2
-> ViewController3
If you want to hide navigation item in viewcontroller1, Add the following line
self.navigationController.navigationBarHidden = YES;
If you want to show title in viewcontroller2, Add the following line in
self.navigationController.navigationBarHidden = NO; //add this if you hide navItem viewcontroller1
[self.parentViewController.navigationItem setTitle:#"Title"];
If you want to hide backbutton and show title in viewcontroller3, Add the following line
self.navigationController.navigationBarHidden = NO;
[self.parentViewController.navigationItem setTitle:#"Contacts"];
self.parentViewController.navigationItem.hidesBackButton=YES;
Add this lines to viewdidAppear method instead of ViewdidLoad ,if you have problems inshowing when switching tabs.
I had the same problem, but what I did to create this problem was that my buttons action was connecting to the actual table itself and not the table Controller. I removed the modal action and created a new action to the table controller and it fixed the problem.
Try to click the Navigation Bar from your storyboard or nib.
Then add your title to the property.
Project Overview
I have a UITableViewController as the root view controller of a UINavigationController. Its view is a UITableView using the UITableViewStyleGrouped style. The table view also has a UIRefreshControl. I am not using nib/xib files, everything is created programmatically.
Problem
The header for the first section in my table view goes under the navigation bar. The refresh control, however, is in the right place. Normally problems with this are caused by a translucent navigation bar, but mine is opaque already.
Attempted Solutions
self.edgesForExtendedLayout = UIRectEdgeNone
This doesn't produce any changes.
self.tableView.contentInset = UIEdgeInsetsMake(20.0f, 0.0f, 0.0f, 0.0f);
This puts my table view in the right place, but causes the refresh control to be adjusted down as well. Not to mention that this is a dirty solution anyway.
Try using:
[self setAutomaticallyAdjustsScrollViewInsets:NO];
You need to use a plain viewcontroller and add the tableview there at the desired position.
This is because in case of an uitableviewcontroller the whole tableview is the parentview . I hope you got my point.
Im trying to create a loading view controller before it loads my tableView. This works fine.
However when the tableView is displayed I get a back button. When clicked it takes me back to the loading view. Im guessing this is because its embedded inside of the navigation controller. Please advise.
if you want to hide the back button just add
self.navigationController.navigationBarHidden=YES;
in the third View controller's viewDidLoad
else add
self.navigationItem.hidesBackButton=YES;
You have different options to choose from, depending on your needs:
The loading view can push the navigation controller.
You could avoid using a full view controller to do your loading, and instead just set a view above the rest of your "offers view controller".
Or, refers to Raon answers if you just want the button to disappear
The navigation controller will keep all the controllers that you pushed in a navigation stack.
So if you push ladingviewcontroller using navigation controller and then pushing tableview controller the navigation stack will contain both the controllers and thats why on pressing back button, you are navigated to loadingViewController.
What I suggest is to remove loadingviewcontroller and show loading view in your tableviewcontroller before loading the tableview. Like, in viewWillAppear of tableviewcontroller, just add a UIView with loading indicator and add it as a subview of tableviewcontroller and remove it after you are ready to show your tableview.
Well, if you just want to hide the back nav bar button, you can do this
[self.navigationController.navigationItem setHidesBackButton:YES animated:YES];
But the better way to show the loading controller's view would be this,
[self.view addSubview:loadingController.view];
[loadingController willMoveToParentViewController:self];
[self addChildViewController:loadingController];
[loadingController didMoveToParentViewController:self];
just hide it or remove it from superView when loading view is not required. You can even animate it while hiding so that it gives a nicer effect.
Here we have a architecture issue, the best way is the following:
Make the 2 and 3 view a single one. I mean you must add the ActivityIndicator at the center of the view that contains the table view.
Make the table view hidden and startAnimating the UIActivityIndicatorView.
Do all your loading stuff.
When you finish loading, stopAnimating your UIActivityIndicatorView and make the table view visible again.
And that's it ;)
Do not push the offers load view controller via navigationController, just subview its view on the offersviewcontroller (the third one) like this in the viewDidLoad method:
OffersLoadViewController *offerLoadView = [[OffersLoadViewController alloc] initWithNibName:#"OffersLoadViewControllerv" bundle:nil];
[self.view addSubview: offerLoadView.view];
After dealing with loading just remove it:
[offerLoadView.view removeFromSuperview];
I'm showing a normal ViewController. Now i will tap on a button and all i want to see is like the following image:
In this image, the background is my root view controller and when i tap on the button, an image view that include black color(alpha = 0.8) will put on top and show my Custom View. In my Custom View, when i tap on DONE button -> the content of textField1 and textField2 will send back to rootViewController and hide my Custom View.
So, could you please help me for solve my situation? Tks in advance.
You can use the delegate & block programming to send the data back to the root View Controller.
Its simple, In Interface builder, Add a UIImageView to the view, and a UIView and connect them both to your .h file. Then set the imageView's values and buttons in custom view and And in your viewwillappear method in .m file, set them hidden using [imageView setHidden:YES];
And when you want to show them just set your setHidden to NO and you should be able to see the customView.