Has anyone created a vertical UIToolBar? Or some sort of vertical menu with UIButtons? - iphone

I am trying to created a vertical menu (on the left side of the screen) which I can display and hide using a gesture recognizer.
I have found a post similar to this which helped slightly, but all it did was rotate the UIToolBar to a vertical position without changing the width or position.
If anyone has succesfully created something similar to this and is willing to help I would greatly appreciate it!
Also, if anyone can point me in the right direction possibly to some sample code I would like that as well.

You could do this with a UIToolBar by applying a 90 degree rotation transform, and then having all your icons rotated 90 degrees to match - you can change the width and position simply by adjusting the UIToolBar frame. However, you will need to create your own toolbar to do this rather than using the built-in one you get with a navigation controller.
Another option is simply to roll it yourself: this will allow you more customisation, so is perhaps the better option. There are a number of third-party implementations of varying types, some based off the current Facebook App side-bar, a good place to start looking is http://cocoacontrols.com - they are of varying quality.
On the other hand, it wouldn't be too difficult to roll your own, so that's a good option to consider.

Related

Constraints issue in Xcode

I'm having some issues with the constraints in my app. Here is how it looks on the iPhone 4 (that's how i want it to look, and how i usually setup my interface, is this the proper approach or not?)
Now, when i switch to the iPhone 5 screen it looks like this
and as you can see, the blue dots (which is UIButtons) are not placed where i want them to be. I made my constraints rely solely on the right side of the view (since that is the one re-sizing, i found that in order for you'r views to align themselves accordingly, it doesn't help to align them to the left side). I don't really know how to fix this. I am finding this new iPhone screen to be a real pain in the arse. Any good advice on how to work with this new screen without a lot of headache would be appreciated :)
Thanks on advance
It looks to me like the are still the same distance from the right side of your view, as you said you set them to be, while the background has stretched to fit the new size. I suspect it's actually the background that isn't doing what you want it to do (keep the same aspect ratio and show more stuff on the left), or try keeping the buttons relating to left and right to stay aligned with the stretched background image.

Create a UIScrollView that can be embedded into another view

I'm trying to build a custom, reusable UIScrollView that can be added to multiple views. The scroll view is going to be a weight picker. For the life of me, I can't find a decent example for how to implement this neatly or cleanly.
I would love for someone to point me to an existing library or tutorial that shows me how to do this. I've hacked apart a few examples, but so far, nothing is very good or reusable. Please help!!
For what it's worth, I have an image that individual ticks for the weight. So I can select to the tenth of the number (e.g. 160.4). The image has the first tick bold and larger than the remaining 9. I'd like to have the weight/number centered over the large tick. I'll update the points to my label/datasource after scrolling stops.
UPDATE
I need to make this. I have the custom font, background, and ticker image.
I would not do this through an UIScrollView. I think it would be more complex and you would certainly end up having issues when trying to add you custom picker into another scroll view.
What I would do is:
building the picker view by means of a series of CALayers, each one representing a "building block" of your picker view; see attached image:
each building block would represent a specific value by mixing a UILabel (the text) and an image;
use a pan gesture recognizer, or alternatively define touchesBegin/Moved/Ended method to deal with panning;
when a pan is done, you displace the view content to the left or right according to the panning;
when panning, you also add new building blocks to the left or right end of the picker to account for empty areas that would be revealed by the displacement done at point 4.
I think that having a look at another kind of custom control source code would be of great help to you. You would not possibly find your custom picker already implemented, but could get some guidance. Have a look then at cocoa controls.
Hope this helps.
If I were going to implement this, I would create a really wide image that had every weight on it I'd ever need - I would probably create this in code when the app started up. This image is then used as the contentView of your picker. You get all the scrolling features "for free", and you could even update the values shown in the other parts of the view during scrolling (or dragging.
The scrollView is just the area with the tick marks and weight numbers, and resides in a subview above the background, but below the centered vertical line that shows the actual weight.
EDIT: on second thought, forget the image. If you have the code to draw the image, you can do the drawing in a custom UIView. So you get the draw rect, you know the contentOffset, so you can draw just what you need.

Looking to mimic the iPhone lock screen camera drag

I've been searching and searching on how apple makes the dragging motion on the lock screen to open the camera so clean. I'm trying to do a similar thing with an app where you drag from the bottom up to reveal a menu, but i cant quite get it right. Anyone know how to, or of any tutorials that show how to do this? Thanks in advance!
To follow up what's been mentioned by Hejazi I believe you can achieve this in 3 steps:
create a background rectangle with some corner radius (this is a property of CGRect).
create a top view, corresponding to the part you want to be able to slide. Attach a pan gesture to this view so you will be able to handle the animation for this view.
for the text part being highlighted I think you need another two views: I will apply a mask corresponding to the text to a view so you get some transparency only for the letters of your text and animate a white round view behind it.

iphone image carousel

I hardly know how to explain my case other than to point to the excellent Absolute vodka app, Drink Spiration.
I am trying to make a carousel like image browsing with a little spice. I would really like to find a simple core animation explanation on how to accomplish something like the above app.
I hope someone can help with this. The solution doesn't have to be exactly the same, but just explain what is happening and it would be best if it was simple and no opengl. Just something to point me in the right direction. I don't think using just a scrollview with uiimageviews is enough.
I wrote something similar and its quite easy once you figure it out in your mind. All done justing using regular old views and animating transforms on them.
Say its 3 images on screen, and you can rotate new ones on and off ... then you will need 5 views set up (most simply just a UIImageView with a relevant image set). They are the currently selected image, the two either side of it and the ones that are, or will be animating on or off when the user flicks left or right.
Each of these 5 images has a position, an angle and an image. When the user flicks left or right each gets animated to the next position and angle, views that are about to come onscreen have their image updated to the next image in the set. If the user keeps on flicking in the same direction you simply reposition views on one side as they come off the other.
With this setup you can do lots of cool carousel like things very simply.

iPhone: No events after rotation

for rotation of my app I use the same view and just rearrange some controls resp. define the appropriate autosize attributes. So, for example, I have a segmented control which goes from the left to the right over the complete screen. When rotating it resizes correct, but I get no events from the segments on the right side (I guess, segements which are located right of the original portrait width).
Does anyone know, why this happens? Thanks for your help.
Regards
Matthias
Found an answer by myself, even though I do not really understand it. Problem was, that I used for the view these "Simulated User Interface Elements". When using those the resize was not done properly. Without them it works perfect.