Making the navigationbar not push down content - iphone

I've been looking everywhere for a solution to this problem but can't seen to find one...
I have an UIImageView similar to facebooks where, if you tap the screen, image text and the UINavigationBar will show up.
The problem is that the UINavigationBar pushes all the content down when appearing...
Is there a way to put this in a higher independent layer or something else that will make it not affect the rest of the view?
Thanks in advance.

I assume when the user taps the imageView, that its your code that's doing the pushing. What you should do is use UIViewController's 'presentViewController:' method. You have some options on how the animation will occur, and while this view will take over the screen, it will not get "pushed:" or appear to be "pushed". In this case the new view is controller by its own UIViewController subclass. [I use this technique.]
The other options is to look at UIView's '+ (void)transitionFromView:(UIView *)fromView toView:(UIView *)toView duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options completion:(void (^)(BOOL finished))completion' method, and rotate a new view into view. Your original view controller will then also control this view, you can do what you want, then when done the user taps something and you flip back to the original view. [I use this technique too].
EDIT:
The solution to your clarified problem in the comment is to set the property on the nav bar to transparent. On iPad now no Xcode handy but you'll see it in the class description.

Since I couldn't find a way to make the content indifferent of whether the navigationbar was there or not, I simply moved up the content 22px (the default height of a UINavigationBar) when showing the bar. This solved my problem perfectly.

Related

Safari Reader font-size control like popover

Safari has a nice popover that is used for controlling the font size. I'm talking about that one:
It's pretty nice, and my question is - how to implement something exactly like this?
Thank you!
There are many projects in github about popoverview, such as this https://github.com/takashisite/TSPopover
One way to implement this is to add a transparent view that takes up the whole screen so that when I touch outside the popover content, it'll dismiss. And the rest you need to do is just add some subviews to your transparent view.
Simple Really, If you want to use a popover then you can see this code PopOver Link
Or you can simply create a UIView containing 2 buttons , let this UIView rollout an animation whenever the UIButton on the bar is clicked and so on and so forth. Let me know for further queries :)

Navigation bar title jumping right after flip transition

I have a simple UIViewController with a simple view. As a result of a user interaction, a new UINavigationViewController is instantiated and its view is being added as a subview to the view of the UIViewController. This takes place as part of an aninmation transition (flip).
This works quite well and the first view is flipped over in favor of the second view. But when the animation comes to an end (the UINavigationViewController's view fills the whole screen) the navigation bar items jump, i.e. the title jumps about 5-10 pixel from right to left, the buttons' jump depending on which side (left / right) they are positioned. During the animation you can see that the buttons are misplaced and that the jumping movement is kind of a repositioning.
Could anyone tell me the reason for this and give me some advice how to avoid this?
This is a little late, but there's no accepted answer and I've encountered this issue even fairly recently (albeit with an older app running on iOS 8).
If you encounter this issue and also see a warning along the lines of the following, it may be that you haven't properly set your root view controller in the app delegate:
Application windows are expected to have a root view controller at the
end of application launch
Modifying the app delegate as follows recently remedied the issue for me:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Other logic goes here
// ...
self.window.rootViewController = myRootViewController; // This was missing
[self.window makeKeyAndVisible];
return YES;
}
(I previously had some nearly-equivalent code that was setting up the view so everything displayed correctly on launch, but was not specifically setting the window's root view controller.)
I know it's annoying, but I have no idea why it happens, but in my experience, it happens in one of two cases:
Translucent navigationBar: maybe it had something to do with the fact that a translucent navigationBar sometimes sets a view's wantsFullScreen property (the view will then extend below the navigationBar).
During transitions: as you have described.
To avoid it, maybe a nice animation to fade it on an off screen before and after animation so as not to give the illusion of low quality.
OR
In viewWillAppear, assign the pixel value it's jumping to the navigationBar's origin.y. It's sad that it happens, but sometimes it just can't be fixed any other way.
This can be caused by partially-corrupt PNGs used for navigation bar buttons when the UIImages are resizableWithEdgeInsets:. If you're using custom button item images, try exporting them again using techniques known to produce reliable images (See blog posts by Marc Edwards at Bjango for a good start).
I recently had a problem that sounds identical to what you were experiencing. I found that using the [UIView performWithoutAnimation:^{}] block inside of transitionWithView fixed it.
During custom segue transition, view's navigation bar items are misplaced.

Make subview rotate too when device is rotated iPhone/iPad

Let me explain what I mean when I say that I want to rotate my subview too. I placed a lot of images to make my self clear. This may look like to much but it is not. Just wanted to be clear.
In the nib file that I am currently working on, I have a UIView and button.
The UIView that I created in interface builder is connected with the IBOutlet named ViewMain:
and the button executes the following method:
and what that method does is that it places the view from another nib file in the UIView controller that I created in interface builder. The nib file that I am actually placing is:
I just placed random controls to illustrate better my point.
so everything so far is great (the view from anotherViewController shows up on ViewMain when the user presses the button)
EVERYTHING LOOKS GREAT BUT NOTE WHAT HAPPENS WHEN I ROTATE MY DEVICE:
I would like my subview (anotherViewController.view) to ratate as well. I don't mind if it is bigger than ViewMain because I can have a transparent background. I just need to rotate it as well. How can I do that?
Define shouldAutorotateToInterfaceOrientation: in you UIViewController so that it always returns YES:
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
Look here for more details.
You should also take care to correctly define the autoresizing behavior of your view and subviews, so that everything is fine when autorotating.
EDIT:
to set the autoresize property for a view in Interface Builder, select the view then go to the "View Size" pane in the Info window and set "Autosizing" as in the image below.

i*-sdk: Placing a bubble on top of all controls

I've got a problem thats been perplexing me for a while. I have a custom control for the iPhone sdk. When the user touches the control I want to draw a small bubble above the users touch position with some information in it. A bit like a thought bubble in a cartoon.
Initially I've done it by adding a UIView subview to the control. However if I use the control where I don't have control of the z-order, for example in a table view, then the bubble will be drawn under other controls.
I've looked around but I'm not sure how to approach this problem. Everything I've read seems to indicate that you need to know the tree structure of the controls. Ideally I'd like to apply it to some layer that sits over the window as a whole, but I'm not sure how. I've also look at core graphics but cannot see any obvious answers.
Does anyone have any ideas of perhaps something they can point me at which will help.
Thanks
If you want to add a UIView to the 'top window', you can use the application UIWindow for that.
UIWindow is a subclass of UIView, so you can just use - (void)addSubview:(UIView *)view to add the new view to the window.
[[UIApplication sharedApplication] keyWindow] addSubview:yourView];
You could try adding it as a subview of the window, though, I don't think that's the most appropriate solution.
Personally, I would add my control as a subview to whichever view (maybe a table cell) and then tell that view to bring your control to the front.
[tablecell bringSubviewToFront:myControl];
That way, when you display your bubble, it'll be on top.

determine if uiview is displayed

is there a possibility to determine if an uiview obj is going to be displayed. imagine: you have 2 uiviews in an uiscrollview. now you are going to switch per gesture from the first view to the second. the first view now is NOT in the viewport. now you are going to go back to the first view. and now I want to be notified that this view is in viewport, or is redisplayed. the same has to be for the second view. I have not found any callback or something like this.
You make sure your UiViewController overrides viewWillAppear: (before it appears this method is called) or viewDidAppear: (after this method is called).
See: http://developer.apple.com/iphone/library/documentation/uikit/reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instm/UIViewController/viewWillAppear:
That depends what you mean by "switch". If one view is just scrolled out of the visible area of the scrollview, but still remains attached as a subview to it, then you may want to check if the bounds of your view overlap those of the scrollviews visible area.
You could do this by using UIScrollView Delegate's scrollViewDidScroll: method to implement a check for overlaps while the user is scrolling.
If however your view is actually removed from the viewstack, then you may want to subclass UIView and implement willMoveToSuperview: to check if the view has been added to the scrollview again.