In my app's implementation, I have a tabbar controller with 5 different tabs.
After I hide my tab bar via the following code
- (void)hideTabBar
{
for(UIView *view in self.tabController.view.subviews)
{
if([view isKindOfClass:[UITabBar class]] || [view isKindOfClass:[UIButton class]])
{
view.hidden = YES;
}
}
}
I still see the bottom portion of my tableview obscured by a white rectangular section (previously occupied by visible tabbar)
For example, before I hide the tab bar
After I hide the tab bar, the tableview still does not completely show on the screen, the bottom section is still occupied by a white rectangular space (previously occupied by the tab bar
As mentioned above, how can I hide the tabbar and ensure that the whole tableview is displayed on my screen?
myViewController.hidesBottomBarWhenPushed = YES;
Related
My app has a banner that is made with horizontal UICollectionView.
And the data of banner get from server.
The banner has two or more count (test count was 4.).
But the VoiceOver only speaks two cell and skips remainder cells.
View Hierarchy is
ViewController > TableView > CollectionView
CollectionView in TableViewCell
- (void)setVoiceOver
{
self.isAccessibilityElement = NO;
self.collectionView.isAccessibilityElement = NO;
}
CollectionViewCell
-(void)setArr:(NSDictionary *)arr
{
_arr = arr;
[self setVoiceOver];
}
-(void)setVoiceOver
{
self.isAccessibilityElement = YES;
self.contentView.accessibilityElementsHidden = NO;
self.accessibilityLabel = [NSString stringWithFormat: "ad%d", _arr["bannerId"]];
}
I want to make VoiceOver reads all banner cells.
I guess the VoiceOver can access the collectionViewCell which is appeared in the screen.
I tested several apps, the cells that I can access with the voiceover swipe gesuture are over the screen a little bit.
like this.
enter image description here
So the voiceover have to adjust to collectionview, not the collectionviewcell.
And we can access each cell by scrolling gesture (three finger swipe)
I'm trying to figure out the best way to have a custom inputAccessoryView rest on top of a tab bar. Currently, I have an inputAccessoryView that rests at the very bottom of the screen, but it covers the tab bar. Any one know the best practice for shifting that inputAccessoryView up?
Currently I have a view defined in a storyboard with a tab bar. Its corresponding view controller takes the view and calls becomeFirstResponder. I've overwritten both:
- (UIView *)inputAccessoryView and -(BOOL)canBecomeFirstResponder
within the view's .m
Found a workaround by shifting toolbar frame by bottomSpacing = tabbar height:
- (void) layoutSubviews {
[super layoutSubviews];
CGRect origFrame = self.frame;
origFrame.origin.y = _keyboardIsVisible ? 0 : -self.bottomSpacing;
self.frame = origFrame;
}
Strangely it works well in JSQMessagesInputToolbar, but it's lost after animations if I do this in UIView that wraps toolbar, or maybe I'm missing something..
I have a UIScrollView sitting inside a popover. It is pinned to the edges of the popover using constraints, and it's full content is able to be displayed in the popover without scrolling (so the scroll view is not scrollable). When I tap a UITextField (located inside this scroll view), the keyboard slides up and the popover resizes. When the popover resizes, the UIScrollView becomes smaller and the content is now scrollable.
So my question is, how can I detect when my scroll view becomes scrollable?
P.S. I want to detect this so that I can set the delaysContentTouches property to YES when it is scrollable and to NO when the content is not scrollable.
You can check to see if the contentSize is larger than the scrollView's bounds.
CGSize contentSize = scrollView.contentSize;
CGSize boundsSize = scrollView.bounds.size;
if (contentSize.width > boundsSize.width && contentSize.height > boundsSize.height) {
// scrollable both vertically and horizontally
}
else if (contentSize.width > boundsSize.width) {
// scrollable horizontally
}
else if (contentSize.height > boundsSize.height) {
// scrollable vertically
}
else {
// same size or smaller, not scrollable
}
The usual story -- I'm making an iOS 5/6 app run under iOS 7 and the navigation bar behavior change is causing a problem.
The app already worked like the iOS 7 default with a full-screen view and a translucent nav bar "over" of the view. The problem is that hiding/un-hiding the nav bar causes different behavior in iOS 7. On iOS 5/6 hiding/un-hiding the nav bar does not change the view. On iOS 7, hiding the bar visually moves the view up leaving a blank bar at the bottom of the screen and un-hiding the bar moves the view back down to occupy the full screen (with the nav bar on top, of course).
I need to continue to support iOS 5 so I don't use auto layout, but I do use the full screen.
I have a view in which I'm viewing a zoomable image -- so the view controller has a fullscreen view containing a scrollView which contains an imageView.
The status bar is always hidden.
I get to the view controller via a navigation controller so there is a (black, translucent) navigation bar which lies over the top of my fullscreen view/scrollView/imageView.
After a brief delay some overlaying labels fade and the navigation bar is hidden
A single tap restores the overlay labels and un-hides the navigation bar.
This works on iOS 5/6 -- the navigation bar slides off the top of the screen uncovering the top of the view/image.
On iOS 7, when the navigation bar slides off the top of the screen the entire view visually moves up a corresponding amount (i.e. 44 points) leaving a black bar at the bottom of the screen. I can see this by setting a background color on the top-level view and resizing the scrollview enough to see the background; the top of the view does indeed move offscreen and the background color is not drawn over the bottom (44 points) of the screen.
BUT, self.view.frame doesn't change and remains at {0, 0} 320 x height.
When I single-tap to restore the overlay info and navigation bar the view moves back down to occupy the full screen and the translucent nav bar is over the top of the view/image.
Nothing I've tried changes the behavior:
Changing the IB view controller layout controls (Under top bars, Under bottom bars, Adjust scroll view insets). Building for 5.1, 6.1, and 7.0 all produce the same result when run under 7.0.
self.edgesForExtendedLayout = UIRectEdgeNone
does nothing. Using the layout delta values doesn't do anything. In IB the view looks the same when "viewed as" iOS 7 and iOS 6 and earlier. I print out a lot of debug info but nothing about the view (or scroll view) seems to change when the view moves "off screen".
The code that shows the overlay info (run when the view is first shown and on single-taps) is:
- (void) showOverlayInfo {
self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
[[[self navigationController] navigationBar] setTranslucent:YES];
[[self navigationController] setNavigationBarHidden:NO animated:NO];
overlayInfoHidden = NO;
overlayInfoFading = NO;
self.infoButton.hidden = NO;
self.infoButton.alpha = 1;
self.descriptionLabel.hidden = NO;
self.descriptionLabel.alpha = 1;
}
The code that hides the overlay info is:
- (void) hideOverlayInfo {
overlayInfoHidden = YES;
overlayInfoFading = NO;
self.infoButton.hidden = YES;
self.descriptionLabel.hidden = YES;
[[self navigationController] setNavigationBarHidden:YES animated:YES];
}
So can anybody tell me what (presumably simple) thing I'm missing?
I finally found my problem.
The key fact is that the image-viewer view controller was in a UIPageViewController,
so what I was looking at and experimenting with was really "inside" another view controller.
Although I had disabled the view controller setting Adjust Scroll View Insets for the image viewer VC, I hadn't done it for the containing VC that created the UIPageViewController and the UIPageViewController presents the pages in some subclass of a UIScrollView. When I changed them for the parent VC, the problem vanished.
So I think the moral of the story is to:
Think about the problem more globally when local doesn't work because maybe you're missing some important context.
If you don't want to use the iOS 7 behavior, change the settings for every single view controller you have!
What is the proper way to implement the status bar and navigation bar that go on top of an UIView?
alt text http://img.skitch.com/20081217-t78sdixk37hqgdh1ia2fgec4st.png
Just set “wants fullscreen layout” in your view controller. That solves the problem for me.
self.wantsFullScreenLayout = YES;
In the screenshot above, there's a translucent status bar and a translucent navigation bar.
The status bar is set using
[[UIApplication sharedApplication] setStatusBarStyle: UIStatusBarStyleBlackTranslucent];
The navigation bar is set using
theNavigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;
If you have a view controller inside a navigation controller, and you want to hide the status bar in order to have your viewController's view in full screen, you can always call :
[self.navigationController.view setNeedsLayout];
after hiding the status bar.
But I personally think
[self setWantsFullScreenLayout:YES];
is a better way.
The best way I came up was this: when using a "complex" hierarchy of Tab bar containing navigation controllers, with one "detail" view being a full screen view.
In the app delegate just before the tab bar controller's view is added to the window, I added this:
tabBarController.view.frame = [[UIScreen mainScreen] bounds];
This will make the tab bar controller cover the entire screen, even below the area of the status bar. I had to offset heights of several views to +20px, notably the navigation bars.
Set the statusbar style as black translucent and navigation bar style as black translucent. If you are using a navigation-based application, in the MainWindow.xib check the status bar is hidden and navigation bar is hidden checkboxes.
When the user touches the screen, start a timer to see if this was a single tap or double tap. If a single tap, make the statusbar and navbar hidden = NO. and once user activity stops, start a timer again. after some time of no activity, make them hidden again.
step 1 Set the UIViewControllerBasedStatusBarAppearance to No in the plist
Then add the following code in did finish launch option
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
[application setStatusBarStyle:UIStatusBarStyleLightContent];
self.window.clipsToBounds =YES;
self.window.frame = CGRectMake(0,20,self.window.frame.size.width,self.window.frame.size.height-20);
}
Please follow this code it worked for me