iPad SplitViewController leftViewController is UITableViewController and back button repaints the screen from top to bottom - ios

I have a SplitViewController (iPad) and its leftViewController is a class inherited from UITableViewController; on the other hand, the rightViewController is a map. In landscape mode, when the leftViewController is shown (UITableViewController), then the user can tap on one item and it is pushed onto the left part of the SplitViewController another list of items (UITableViewController). As a result, it appears the title and the back button with the title of the previous list (this is the back button offered by the UITableViewController, so I have not programmed a new button to implement that behavior). During all that process the map does not change (and this is the desired behavior).
The problem is related to the back button and in landscape mode; that is, when it is pressed then the previous list is shown (and this is the desired behavior), however it seems like all the screen (the menu bar at the top and also the sliptviewcontroller -with left and rigth viewcontrollers) is refreshed (repainted) from top to bottom during less than one second.
I am quite sure that is not a problem related to animation because I have commented, in the code, all the sentences related to animation, and, I also have set to false all the function arguments like "animate:".
It is a esthetic problem, but I would like to correct it.
Thanks in advance,

Solution: Implement in the left view controller the following method.
- (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation
{
return YES;
}

Related

InteractivePopGestureRecognizer not animating correctly

I have rather complicated structure of my UIViewControllers, so interactivePopGesturerecognizer behaves strange.
First, my VC hierarchy is as follows: I have a UINavigationController which is in AppDelegate's rootViewController VC. Then I push a VC which servers as a placeholder for 5 VCs on same level, i.e. those VCs are siblings which I use as VCs in infinite horizontal scroll system. I add their views to pushed VC. Now, each of those 5 VCs have UITableView and after pressing rows, those tables push details VC on stack. Details VCs are being animated just fine when being pushed to stack. Even when I hit back button on details VC, I see parent UITableView animating in the background. The problem arises when I try to swipe the details VC to pop it off stack. Then I get this, there is no UITableView in the background that animates.
So far, I've done this:
- in my AppDelegate.m I enabled interactive pop gesture navigation.interactivePopGestureRecognizer.enabled = YES;
in my details VC I set delegate self.navigationController.interactivePopGestureRecognizer.delegate = self;
When the animation finishes, i.e. details VC goes right off the screen, my parent VC with table magically shows up. This doesn't happen if I press button, in that case, that UITableView animates from left and stays in position.
I presume that since I'm having situation with horizontal scroll UINavigationController loses it's position after I scrolled to another UITableView so parent table is someplace else. But how come when I press the back button, I can see that table animating from left?
I also tried to explicitly add UITableView of current VC that is on screen to navigation stack by pushing it, but the problem arose when I tried to pop it of stack and show it again, it stayed invisible.
I don't want to have multiple UINavigationControllers because when I swipe them inside UIScrollView, I want my bar to be fixed in position.
So, main question is: how to have the same visual behaviour with interactivePopGestureRecoginzer as I get with back button for free (animated parent UITableView), considering the fact that I have 5 sibling VCs that are not part of navigation stack, but merely their views added to parent VC which is on navigation stack?
Thanks!

ios SWRevealViewController reveal push segue animation

I'm using SWRevealViewController(the updated version) to make a slide-out sidebar menu app,
connecting different rear view controllers (based on different sidebar cell tapped) by
SWRevealViewControllerSeguePushController class segue.
every time I tap a cell which is different from the current one
the sidebar becomes fully reveal then the new rear view controller gets pushed-in from
the right side.
It looks like the old rear vc first moves to the right (totally invisible) and
then the new one moves
to the left to show full screen.
That does not look smooth, I want it looks like I'm always using the same view controller when
different cell tapped and the rear vc would always be visible at least a part of it.
any way to modify the original animation setting?
thanks in advance!
finally found the setting method in
- (void)_dispatchPushFrontViewController:(UIViewController *)newFrontViewController animated:(BOOL)animated
{
FrontViewPosition preReplacementPosition = FrontViewPositionLeft;
if ( _frontViewPosition > FrontViewPositionLeft ) preReplacementPosition = FrontViewPositionRightMost;
//change FrontViewPositionRightMost to FrontViewPositionRight
Alternatively, you can simply edit the _rearViewRevealOverdraw property in SWRevealViewController.m to be 0.0f to prevent the rear controller from revealing any more of the rear view during the presentation animation.

UIButton on left side of screen (in iOS 7 navigation slide area) not highlighted

I have a UIButton on the far left of a view controller (on a XIB), of say 100 points wide.
If the view controller is on a regular tab (i.e. not pushed on navigation stack) the button highlights as expected when tapped.
However, when the view controller is on a More-tab (so pushed on the navigation stack), the button is not highlighted when tapped on its left side (say the left most 50 points). The button does function, it's action is being called. But, when tapped on the right side it does highlight. (BTW, I think this is a general issue when the view controller is pushed from any other view controller; does probably not have to be More tab.)
After some research it turns out it's when I tap in the left screen area with which you can iOS-7-slide back to the parent view. Any ideas why this is, and how to make the button work properly again.
Thanks for your time!
I can confirm this bug with almost no code at all. All you need is an image file to serve as the background image. In the storyboard set this up:
Navigation Controller -> (root view controller) ViewController -> Button -> push segue... ->
ViewController2 -> Button
Put the second button up against the left side of its containing view (ViewController2's view) and set the image file as its highlighted background image.
Now run the app and tap the first button, to summon the second view controller's view. Tap the button at its right side: the highlighted background image appears. Now tap the button at its left side: the highlight background image does not appear, but the button is in fact receiving the tap (you can confirm that by giving it an action method that logs).
So, I would say you've got yourself a legitimate bug and you should report it to Apple. I'm certainly going to!
Unless you require the iOS 7 swipe-to-pop gesture, you can fix this bug by disabling that gesture recognizer:
self.navigationController.interactivePopGestureRecognizer.enabled = NO;

Created custom UINavigationController - using the iOS 7 swiping gesture doesn't work properly

So I had created a very simple custom NavigationController a couple years ago, of course it subclasses UINavigationController and the only method it overrides is
- (BOOL)navigationBar:(UINavigationBar *)navigationBar shouldPopItem:(UINavigationItem *)item
in it I show a UIAlertView asking the user to make sure they want to go back. When they select yes it goes back using
[self popViewControllerAnimated:YES];
Everything is working right except for with iOS 7 when using the new swiping from left to right gesture to go back to the previous screen.
It correctly goes back to the previous screen however the top navigation bar doesn’t change.
For example if I’m on my main screen and I click on Row1. The view will change and the nav bar will display Row1 as the title and a ‘< Back’ button on the top left.
Clicking on the ‘< Back’ button works 100% as expected.
If I swipe left to right to go back, the view will go back to my main screen however the nav bar will still be showing the ‘< Back’ button and ‘Row1’ as the title.
I tried just using UINavigationController instead of my custom class which subclasses it and the swiping features work correctly so I know that’s the problem. I must be missing a call or something in my custom class
Any ideas?
Thanks!
EDIT:
I just edited my CustomNavigation code a bit and it now seems to work. When using the top left Back button for some reason shouldPopItem was getting called twice, so I had some code to make it work correctly with iOS 6 and lower.
When using the swipe gesture I noticed that it was only being called once and the first time I was popping the controller but returning NO (which was why the nav bar wasn't changing). I now put a check for iOS 7 and return YES right away which fixed the problem and now works properly.
navigationBar:shouldPopItem: is a delegate method on UINavigationBar, which UINavigationController implements. So all you're doing is stopping the navigation bar from popping a UINavigationItem. That's why when you override this that it prevents the navigation bar from removing the item associated with the UIViewController being popped. It shouldn't actually ever prevent the navigation controller from popping a view controller, and it was probably just a side effect of the old implementation that made it work right. Either they changed something, or there's just a difference with how it works when the gesture is used, that makes this hack no longer work right. Anyway, generally you're not supposed to be able to prevent the back button from going back. If you want to present a screen that requires some kind of confirmation to go back, or a task to be completed or cancelled first, you should present a modal view controller instead. Otherwise, you could replace the default back button with your own and hide the normal back button. Then your custom button (which would look different unless you went to a lot of work) could call a custom method to prompt first.
Of course you'll want to disable the pan gesture if you stick with using a UINavigationController. There's a property on UINavigationController to get the gesture recognizer:
#property(nonatomic, readonly) UIGestureRecognizer *interactivePopGestureRecognizer NS_AVAILABLE_IOS(7_0);
You can disable it so that it will no longer make you go back.

Tabbar not showing in ios application

i am making one iOS tabbar application in that i have put 4 different tabs and whenever i click on 1 st tab and load another view after clicking of the first tab. After that when i press back button then tabbar is not displaying .So that i want hint that how can i show that
back the tabbar when we move from one tab from another and yes how i can use consistent the tabbar in whole application can you just guys help me on this i am new to iOS development.
here i am put the screen shot ...
here first screen is this one..
when i tap the video button that are first in the view then another window open
which are as under and see the tabbar is not there...
when in video controller there is tabbar is there but i drag and connect to that then tabbar is disabled
Looking at your screen snapshots, do I correctly assume you're attempting to transition to the "Videos" scene by touching the big "Videos" button in the center of the "Home" scene (rather than touching the tab bar button at the bottom of the screen, which I assume works fine)? If that's the case, you need to have your button tell the view controller's tab bar controller that you want to change the index of the tab bar, and it takes care of it for you. You cannot do the transition using a segue (or at least not without a custom segue, which is even more complicated than the procedure I outline below). If you're changing the view some other way (e.g. using a standard segue or using presentViewController, pushViewController programmatically, etc.), your tab bar can disappear on you.
You later said:
when in video controller there is tabbar is there but i drag and connect to that then tabbar is disabled
Yes, that's true. You cannot use a segue from one of your big buttons to one of the tabs in your tab bar. (Or technically, if you wanted to use a segue, it would be a custom segue which would do something very much like my below code, though perhaps a tad more complicated.) So, rather than using a segue for your big button, you need to write an IBAction (connected to the big Videos button on the Home scene), that tells the tab bar to change its selection:
- (IBAction)clickedVideosButton:(id)sender
{
[self.tabBarController setSelectedIndex:1];
}
A couple of comments:
My answer was predicated on the assumption that your tab bar works as expected when you tap on the buttons of the tab bar, itself. If you tap the buttons at the bottom of the screen, do you transition to your other views correctly and preserve the tab bar? If so, my answer above should solve your issues in getting the big buttons to work. If not, though, then the problem rests elsewhere and you need to show us your code that might account for that (either you're something non-standard in the UITabBarControllerDelegate methods, or your viewDidLoad of the view is doing something nonstandard).
If I understand your user interface design right, you have the tab bar at the bottom as well as the big buttons in the middle, which presumably do the same thing. That is, no offense, a curious user interface design (duplicative buttons, requiring extra tap on a button, etc.). You might want to choose to either use either big buttons (in which you can retire the tab bar, eliminate the IBAction code I've provided above, and just use a nice simple navigation controller and push segues, for example), or just use the tab bar (and lose the home screen, lose the big buttons, etc.).
You also made reference to "press back button", and I don't see any "back" button on any of your screen snapshots. Do I infer that you have a navigation controller and you're doing a pushViewController or push segue somewhere? If you're doing something with back buttons, you might need to clarify your question further.

Resources