Drawing my view on top of navigation bar - ios

Can I draw my custom view on top of navigation bar? I am trying to get a control like Google chrome's more button.

I see you are using kxmenu for drawing the view.
Instead of drawing the menu in self.view, draw it in screen window.That way, you could draw over the navigation bar.
Further, to exactly replicate the Google's popup action. Follow these steps
1. Create a tableview, populate with options, Give a header view with the share, reload, and favourite menus
Find the touch point on the screen, i.e, in your case, the centre of the right bar button
Add the table to
[UIApplication sharedApplication].keyWindow
Animate the table

Related

Swift ios: drag view controller onto screen

Is there any way to drag a view controller onto the current view controller using Swift? I would like to drag from the bottom of the screen and have the new view controller follow the finger. When the finger releases, I want for the view to snap into place. The view controller that I plan to drag on needs to have a transparent background so that the previous view is still visible. I tried using a swipe gesture paired with an animation that brings in the view from the bottom, but the previous view turns black momentarily before the animation is complete. Also, it doesn't follow the finger's path. This is similar to what happens when you try drag from the bottom of the camera app. It brings up a page, following your finger, and darkening the background. I am doing this programmatically. Thanks.
To do this you will need to use a UIPageViewController and set its transition style to scroll and navigation to vertical. There are lot's of great tutorials on how to use a UIPageViewController so just look online.

Placing a share button over a uiwebview

I have an rss app that I'm working on in xcode and the articles load up in a full screen web view. I need to place a "share" button in the navigation bar but since my uiwebview is full screen it won't show up when I run the app. I even tried cropping the top of the web view lower and placing the button there but still no luck. Here is an example of what I mean:
The share button needs to be on the right side of the navigation bar but i cannot seem to figure out how that make that work.
Thanks in advance
Fist of all, your top navigation bar seems to be missing (judging by your image). Since the nav bar is missing there is no possible way that the share button will be visible. You can do this is the IB or in your code.
For your IB you can move the view controller's 'layer's' so to speak. When you place all the elements down, your VC should look something like this:
On the left hand side we can see what subviews are at the top and which ones are at the bottom.
As we can see here that the UIWebView is at the top of the list, so it'll be at the bottom of the pile. The navigation bars are further down the list so they'll be at the top of the pile. So due to this they'll go over the UIWebView.
The other way to do this is using insertSubview:aboveSubview:. Fist of all you'll add your UIWebView using addSubview: and then add the nav bar using insertSubview:aboveSubview: and finally you'll add your button the someway as you did for the nav bar, but this time you'll be adding the button above the nav bar not the web view.
My best guess is that your forgetting to add another navigation bar to the top of the screen. Hope this helps!!

tab view like button slides up

I am trying to have a button that is located on the bottom and when the user taps on it it will slide up to show the menu. How is this possible using code or is there an api or anything that I can use to make this possible in the easiest way?
Your screenshot shows a view whose frame is animated when the button is pressed so that either the height of the view, or more likely just the position, is changed so that the view becomes visible. This is a simple UIView animation and the view being added so it is hidden behind the button initially.
Check out the iOS documentation for Animating Views https://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/AnimatingViews/AnimatingViews.html
You should be able to create the view and its content either with the interface builder or in code. Start with the view off the bottom of the screen and then use animateWithDuration:animations: using the frame property.

Mimic iOS 7's Home Screen Search Bar on my app

I want to implement a search bar in my app which mimics the one on iOS 7's home screen. When I pull down, I want it to bounce down while having enough room on top for the status bar, and I want my current view to move down to make room for the search bar as well. How should I go about with this?
My current thought is to make a new UIView class, add a UISearchBar to it and add that view to my current view (So that I can scroll down to display the search bar). But is there a better way to do this?
This is how it looks like on the iPhone home screen
http://static.trustedreviews.com/94/000028d08/1a0e/Spotlight-Search.jpg
As you said you could create a UIView with a search bar in it. Add it to your main view and set your searchView origin.y to be less than 0 so it will hide below the top of the screen.
Next you could use a UIPanGestureRecognizer to track the dragging of your finger and update the origin.y of your searchView while you drag..

Show menu controller on top of cell in iOS collection view

I want to show a UIMenuController with custom actions when the user long pressed on a cell in the collection view which is embedded in container view.
I have implemented as mentioned in this stack overflow solution which is working fine. Copy Callout in UICollectionView
The problem I have now is menu items are coming below the cell even though I kept the arrow direction to UIMenuControllerArrowDown.
My collection view is part of a container view which is inside a view controller. When I press on an image in the collection view, it is showing the menu item on the bottom of the cell. How can I show it on the top?
I tried to show it in a particular view as below, but my effort got no use.
[menu setTargetRect:cell.bounds inView:parentControllerView];
Can someone suggest how I can resolve this problem? Let me know if my question is not clear or needs more details.
Your menu is showing bottom of the cell as you have set the cell's parent view to display menu, the parent view's height is not capable to display your menu below your cell, so it is displaying overlapping your cell.
So if you want to show your menu below your cell not no it you have to change the view in which menu is showing..set
[menu setTargetRect:cell.bounds inView:[UIApplication sharedApplication] window];
this will display your menu in main window of application.
The problem arises when you try to present the menu above a view that would result in the menu appearing overtop the navigation bar. iOS doesn't want to show it overtop the nav bar, and instead will push it down. If your items were lower on the screen, it would properly appear above the view and point down to it as expected. It may be worth filing a bug report at bugreport.apple.com to request the menu appear overtop the navigation bar.
Also, it is good to use the cell's bounds as the target rect, and the cell for the view as opposed to the parent controller's view, like so:
[menu setTargetRect:cell.bounds inView:cell];
Now, I have found a workaround to force the menu to appear over the navigation bar. Instead of providing the cell's bounds as the target rect, push it down a little bit yourself. For some reason, doing this will prevent iOS from pushing it down when it would appear over the navigation bar.
[menu setTargetRect:CGRectMake(0, 10, cell.bounds.width, cell.bounds.height - 10) inView:cell];

Resources