Closed mbcoder17 closed 10 years ago
Hi, What is not updated is the example, not the class. The SWRevealViewController should already work with iOS7. It is not responsibility of the SWRevealViewController class to adjust offsets of your child controllers.
According to Apple, UITableViews managed by UITableViewControllers already adjust automatically the insets of the table. I found this is right and it works. However if you use a UITableView in other ways you may need to adjust them manually.
Hmmm...
This is what happens when I run it on my iPhone 5 running iOS 7:
Am I using the wrong version? Should I have taken the files from one of the Example projects?
Thanks
The problem you're having is a problem you'd have even if you weren't using SWRevealViewController. iOS7 only automatically adjusts the insets of the table for UITableViews managed by a UITableViewController and inside a UINavigationController. A standalone UITableViewController won't have it's insets adjusted and you'll get the behaviour you have shown. I had the same problem, you'll have to adjust the insets yourself or embed the UITableView inside a UIView so you can prevent it from going under the status bar.
Thank you! I'm kinda new to this, so how exactly would I do what you suggested?
In your view controller viewDidLoad
method, try this:
[self.tableView setContentInset:UIEdgeInsetsMake(20, self.tableView.contentInset.left, self.tableView.contentInset.bottom, self.tableView.contentInset.right)];
20 is the top inset, to clear the status bar. See if that works for you. I haven't tried that method, the table view content may well still scroll under the status bar.
What I did in my project was instead of using a UITableViewController
I used a regular UIViewController
and embedded my UITableView
inside a regular blank (well, grey) UIView
, leaving a 30 point gap at the top and bottom. One downside to this is that you'll have to implement the UITableViewDelegate
and UITableViewDataSource
protocols yourself (UITableViewController
usually does this for you).
Here's what my app looks like:
Thanks again! I'm having issues with my status bar though too...it seems to be black on the main view, then when I swipe, it becomes transparent, is it just transparent the whole time?
The status bar is transparent the whole time. In your screenshot you can see the green battery icon over the black status bar area on your front view. That black area appears to be part of your view controller. As far as I know the only thing you can change (on a per ViewController basis) is whether the content of the status bar is dark (as above) or light (use if your views have a dark background).
With the latest implementation the controller automatically adds an inset for accounting the status bar to child controllers which main view is a UIScrollView (ex. UITableViewController)
Apologies for asking on a closed thread but i'm still struggling with this.
I have a table view controller as the rearviewcontroller, inside this is simply a tableview, now i have tried embedding this table view into a scroll view (and setting the scrollview delegate to the viewcontroller in the storyboard).
I have also tried embedding the view controller in a navigation controller but again now joy, could you please provide an example of how this should work.
Is this an issue that you are actively still looking into?
Just a heads up for anyone who had this issue,
I have now got the functionality working on both IOS 6/7 for both the iphone 4/5
Hi,
As said in my post above, the revealViewController class already handles viewControllers which view is a scrollView -such as UITableViewControllers-, so there should be no need to implement that much code or add additional views or even constraints, as content offsets are handled automatically by the revealController. Look at the example RevealControllerProject3. Just by using UITableViewController for the rearViewControllers everything should be ok. I do not fully get why this is not the case on your projects, did you actually try this?. Thanks
I didnt get it. I'm having issues with my status bar too. It is black. How do i change it?
I used the following hack to avoid black background in my SideMenuViewController viewDidLoad function.
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationSlide];
CGRect whiteBarFrame = CGRectMake(0, 0, self.tableView.frame.size.width, 55.0);
UIView *view = [[UIView alloc] initWithFrame:whiteBarFrame];
[view setBackgroundColor:[UIColor whiteColor]];
self.tableView.tableHeaderView = view;
Since version 1.1.0 the class correctly attends to
in its child view controllers, so if you implement it the status bar should update according to the controller that is currently presented. This is now demonstrated on the RevealControllerProject3. Please have a look at it.
Thanks
I know in the readme file you said this is not yet updated to take into account the new layouts in iOS 7, but is there a way I could just adjust the tableview offset so it doesn't run into the status bar in iOS 7?
Thanks