floating button above UIScrollView in Storyboard - iphone

Is there an easy way of putting a 'floating' button above a UIScrollView in Storyboard? I would like to add a lock button to toggle scrolling on and off. I guess I could do this in code but it would be nice if it could also be done via XCode.

Just drag the button onto the view somewhere over your UIScrollView. Now, IB will automatically dump it in the scroll view, but you can move it out by using the object browser.
Open the object browser
Drag the button out to the same level as the UIScrollView
Ensure that the button is below the scroll view in the list (this means it's above the object in the view hierarchy)
You may have to use the inspector to set the button's actual location rather than dragging it around. Dragging it around for placement will most likely cause it to jump back into the scroll view.

Related

iphone - Shrink image on scroll away in UIScrollView

So I have a UIScrollView in my app's menu. I have paging enabled and each page contains a button and an image. I would like to add a little animation where these start to shrink as they disappear off the screen (when the user scrolls to the next page).
I know I could do this by creating a property for each button and image and then manually changing the frame size in the scrollViewDidScroll method.
Does anyone have a more elegant solution so that I dont have to hard code each one in? It is possible that there's a predefined attribute for this or something?
Is each "page" in the scrollview actually a view or view controller? Whatever it is, hopefully it's an instance of some class, and thus reusable. Add a method to the custom view/view controller that uses the UIView animateWithDuration: methods to make the button and image shrink. Call that method when you determine that the scroll view has moved enough.

Adding a UIToolBar above a UITabBar - Logic Issue

I need to know the logic of how to write this code.
This is my problem.
When a user taps a button, I need to show a UIToolBar (with a few buttons on it) on the view. This toolBar should appear ONLY above the UITabBarcontroller.
The view is a UIScrollView, so if I hardcode the position of the UIToolBar, it will be displayed in the wrong position each time the user scrolls (Hope you understand what I am saying).
I did the following. I hard coded the position of the UIToolBar (so it will place above the tab bar), and added it to the Window. This sounds like a good solution as the windows size will not change at all instance.
But, I don't want to add this to a Window. So is there any other way I could solve this problem?
I would add an additional UIView to the window so that it acts as a container for both the UIScrollView and UIToolbar. Then resize the scrollview so that it falls short of the toolbar.
You should be thinking of this as layers of views

Adding a Stationary Button Overtop of a Map View

I have a really quick question which is probably ridiculously simple. I currently have an application that I am using route-me and OpenStreetMap, and basically I have a view that loads the map into the entire window.
When trying to run the project with a button added to this view in Interface Builder, the map loads overtop of the button, and is not displayed.
The map view is loaded by a custom class RMMapView (route-me class), and I already know how to add markers to the map itself, but not a stationary button in the corner of the screen that won't move as the user drags the map around. I want to add the button as an overlay, a view overtop of the map view itself.
If you guys could give me any tips on how to do this I would greatly appreciate it.
Thanks.
[mapView bringSubviewToFront:button];
Maybe this helps.
Add the mapView as a subview to a view, and add the button as a subview to the same view.
In Interface Builder, on the left side pane that has all the scenes, switch the positions of the button and the MapView. If the button is listed above the MapView, drag it down so it's below it.. or vice versa. This will change which view is on top of the other.

xCode 4.2 iOS5 interfaceBuilder cannot tap on a button that is laid out in the IB

I've ran into a weird issue lately:
I have a 320 x640 UIView within a UIScrollView. I've manually positioned buttons throughout the view and assigned actions to them. One of the buttons has a center at [x,y]: [287,440]. The button is 60x60.
I can tap all other buttons and controls located as low as Y = 353.
I see that the button is located on the same level as all of my other buttons, within the same view as them.
What could be causing my button to be completely untappable? I have another controller, which is also "tall", and there buttons located "off screen" are tappable. [If I move the button up to the level of other buttons, it works as expected.]
Here's the scroll view code:
self.scrollView.contentSize=CGSizeMake(320, 640);
Something is covering it. Try looping over all subviews and printing origin.y relative to scrollview origin.y, and then height plus relative position. Do this in viewWillAppear. Be aware that autoresizing behavior can kick in right after viewDidLoad and fool you. That is what happened to me earlier. There will be an overlap somewhere.
Can post code example later from home if this doesn't get you through it.

custom slide to reveal toolbar

i want to do a custom toolbar, something like the slide to unlock of android phones. In idle state, the user can see a button of the bottom left of the page. the user would then tap it, drag towards the right. When the user reaches the right end, the toolbar will then 'lock'. Buttons would be located at the toolbar.
I'm think of using a customview and touchmoved functions, but what I don't know how is how to make the view move with the touch, and how to actually lock the bar.
Everytime you move your finger the touchmoved function is called. In the touchmoved function you have to redraw the whole view or just set a new frame for this view. It pretty simple as you already know how to detect touches and react on them.