tableView wierd behaviour while pushing in navigation controller - ios

I am having some issue while pushing a viewController in UINavigationcontroller .
What i have is , a UITabBar and when click on the button it loads new viewController in UITabBar's UINavigationcontroller .
I am using this to push it ...
UIStoryboard * storyboard = self.storyboard;
loginEmailinviteViewController * detail = [storyboard instantiateViewControllerWithIdentifier:#"loginEmailInvite"];
[self.navigationController pushViewController: detail animated: YES];
Every thing is perfect but the only problem occurs in tableview which looks wierd there . It takes some space above its starting point as if it is on navigation bar .
Please check and help me .
Thanks

This is another tricks,,
In Your Story Board,
Drag View Controller
Embed with Navigation Controller
Drag Table View [Not Table View Controller] and put in View Controller
Check the Table View's Y position in Size Inspector
If it shows 64 or anything, change to 0
Drag Table View Cell and put in Table View
Cell will not get down.

In your view did load add following line :
self.automaticallyAdjustsScrollViewInsets = NO;

Related

Add a UINavigationController nested inside a container view controller to a UITabBarController

I have a UIViewController (red) set as the first tab of a UITabBarController as shown in the storyboard below. This view controller is a container view controller and loads a UINavigationController inside its contentView (the white rectangle inside the red view controller).
This is my code for loading the navigation controller inside the red view controller's contentView:
- (void)viewDidLoad
{
[super viewDidLoad];
// instantiate navigation controller
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:#"Main" bundle:nil];
UINavigationController *navigationVC = [storyboard instantiateViewControllerWithIdentifier:#"N"];
// place navigation controller inside content view
[self addChildViewController:navigationVC];
navigationVC.view.frame = self.containerView.bounds;
[self.containerView addSubview:navigationVC.view];
[navigationVC didMoveToParentViewController:self];
}
From what I know about view controller containment this should work as I am explicitly setting the frame for the navigation controller. However, when there are enough cells in the tableView to exceed the container's height there is always a bar at the end of the tableView when I scroll down. I have set the tableView's backgroundColor to orange and the cell's backgroundColor to white in order to see the difference.
How do I get rid of that orange gap at the end of the tableView?
(Note: I am not using autolayout and I need a solution that works for both - iOS7 and iOS6.)
I know you are also looking for an answer which works on iOS 6, but on iOS 7 and above you can use
self.extendedLayoutIncludesOpaqueBars = YES;
Have you tried setting self.edgesForExtendedLayout = UIRectEdgeAll; in -(void)viewDidLoad of Table View Controller - Root?
Note: iOS 7 only

Modal View Controller with MapView And TableView

I'm looking to replicate the basic functionality of the Stores finder in the new Starbucks app (MapView with a tableview bellow it) but am unsure as to how I would go about implementing the sliding aspect of presenting the view
The main aspect of the functionality I am trying to replicate is the ability to present the modal and have it dismissible by sliding it down off the screen as I am able to replicate the Map + Table view already
https://www.cocoacontrols.com/controls/kipulltoreveal Just make a custom cell and you can make it identical.
Well from the Gif you posted, It seems that Starbucks just present the view controller modally which is very easy to do.
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:#"Main" bundle:nil];
YourViewController *yourVC= (YourViewController *)
[storyboard instantiateViewControllerWithIdentifier:#"yourView"];
[self presentViewController:yourVC animated:YES completion:nil];
As for dissmissing the view you would need to set ViewController's interactivePopGestureRecognizer delegate to self and then handle its behavior in -gestureRecognizerShouldBegin:
That is, when you want the built-in pop gesture (– popViewControllerAnimated:) to fire, you must return YES from this method. The same goes for your custom gestures - you have to figure out which recognizer you are dealing with.
My thought is this is just a viewcontroller containing 2 basic views:
The background view including tabs and your personal info page which is below tabs.
A table view occupying the whole screen.
section 0: header: empty header / no cells
section 1: header: search bar / 1st cell: mapView trespassing its bounds to cover section header / other cells: locations
Whenever you scroll down 'too much' they defined. They do animation to hide the tableview
To make it looks like a modal view, they make the map corner rounded.

manage size of presented tableviewController

I have presented a tableview controller on a view controller.That tableview comes as full screen on view controller but I do not want to present the tableview on full screen.Is there any way to manage the size of presented vie controller. And the second problem is that i want to present a vie controller which have some label , some text boxes and a table view. Please help
IF you are using iphone device then the viewcontroller will occupy
the full screen .
If the device is iPad,then u can use modalPresentStyle.
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:yourVC];
navController.modalPresentationStyle = UIModalPresentationPageSheet;
[self presentViewController:navController animated:YES completion:nil];
For iPhone ,add the views like UILabel,UITableview to the mainView and present it.
The UITableViewController is used when the table view is the main view of the controller.
In your case it seems more appropriate to use a normal (subclass of) UIViewController and add a UITableView as one of its sub views.
Then you can resize it as you prefer and add other elements (labels...) as additional subviews.
Usually in this configuration you may want to set the view controller as the delegate and dataSource of the table view.
Does this answer also your first question?
You could not change the size of the presented view controller. Another way to do it is by adding it as childViewController by:
[self.view addSubview:tableViewController.view];
[self addChildViewController:tableView];
Then you can change the size of the tableViewController as you wish.

Want to Push another View from current view

I am doing paypal integration and my project is working good.
But i want to push my Next view from my current view. first i used Navigation Controller but now i want to push it with out navigation controller.
I used the syntax with Navigation controller is
[self.navigationController pushViewController:[[[NextViewController alloc] initWithURL:[ECNetworkHandler sharedInstance].redirectURL returnURL:RETURN_URL cancelURL:CANCEL_URL] autorelease] animated:TRUE];
And i used the syntax to push another view controller without navigation controller is
NextViewController *webVcustome = [[NextViewController alloc]initWithURL:[ECNetworkHandler sharedInstance].redirectURL returnURL:RETURN_URL cancelURL:CANCEL_URL];
[self.view addSubview:webVcustome.view];
With Navigation it works but without navigation it don't.
What should i do to push the view controller.
instead of adding a subview call presentViewController:animated:completion, like this:
[self presentViewController:webVcustome animated:YES completion:nil];
for more information of this message take a look to the documentation
If you want to "push" a view without using UINavigationController , I think you can only use two views to adjust their frames when they are begin "push" movement.
eg:maybe you can creat 2 subviews such as : currentView , anotherView. And then add them to the self.view.
maybe you can set the currentViews frame is (0,0,320,480) and anotherViews frame is (320,0,320,480) , when you want to "push" them , you can set their frame is the currentViews frame is (-320,0,320,480) and anotherViews frame is (0,0,320,480) with a UIView animation

Setting a title and a UIBarButtonItem in WePopoverController

I am implementing a WEPopoverController and would like to set the title and put a button on top of the popover. Is it possible to do that with this controller?
This is what I have so far. I am loading TableViewController into the popup.
I tried to set self.title=#"title"; in the tableviewcontroller's viewdidload but that didn't help. I only see the tableview with borders inside.
I tried to create a tableview controller in storyboard and programmatically load into the popup but i couldn't resize it. Plus i am not sure if that would be good programming practice.
This is how i load the popuptableview. Would it be easier to use a UIViewController? I don't really need the tableview.
PopUpTableViewController *popUpTable = [[PopUpTableViewController alloc]initWithStyle:UITableViewStylePlain];
// TestViewController *testView = [[TestViewController alloc]init];
self.popoverSettingsController = [[WEPopoverController alloc]initWithContentViewController:popUpTable];
[self.popoverSettingsController presentPopoverFromRect:frame
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionDown|UIPopoverArrowDirectionUp
animated:YES];
I looked through the preference options but didn't see anything about title. Would i have to resize the container?
You should create a navigation controller with your popUpTable as root view controller and then use the navigation controller as the content view controller for the pop over.
If the above is done, then your logic of self.title inside popUpTable and creating bar button item will work!

Resources