How to create an "Add to reading list" animation effect - objective-c

I'm trying to make an animation effect similar to the one on Safari(iPhone) when you add an element to the reading list. It's similar to the one that appears when starting to download an item from App Store application: the application item drops to the dock to start downloading.
First it bounces up and then goes to the dock. It's a very nice effect that Apple uses on their OS.
I have an image view on screen that I want to drop with this kind of animation to my toolbar in my application.
If there is someone who did it or know what's the name of the effect, could please tell me how to do it.
Thank you.

"Add to reading list" shows no animation on my phone but of your description it sounds like the "Open in background"-animation in Safari (iPhone). My answer describes that animation.
I wrote a thing like that a few months ago and much of it is doable while some of it is not. Your questions showed me that more people are to know how it is done so I wrote a blog post about it. I will describe the high level approach and challenges here but you can read more about it in that post.
Getting to content to animate
If you choose to animate the view that is on screen down to the (in your case) tool bar then you will only have to access its layer. If you want the original view to remain and animate a visual copy (like the "open in background"-Safari animation) down to the bar item then you should create a new layer and draw the content of your layer into an image and set that image as the content of the layer that you are animating
Calculating the end position
The start position of the animation is simply the frame of the view. The end position is very tricky since bar items (both tool bar items and tab bar items) are not UIView subclasses and doesn't have a public view property. This causes problems when you want to shake the bar item later on.
I decided to make a visual approximation of the end position using some simple heuristics. If you know before hand that you will only animate to a single bar item then the end position can be hard coded to a suitable frame.
Animating along a path
There is nothing special to moving, scaling and rotating the layer from the start to the end position. If you want to read more about how I did it you can look at the post I wrote.
Shaking the bar item
This cannot be done without a lot of custom code or using private API at the moment. Since bar items doesn't have a view or a layer there is no accessible layer for you to animate. I guess that you could have a custom animating image that does the shake and set that during the animation and set the new image afterwards. The approach of drawing into an image and animating that doesn't work that well either since there is no accessible layer who can draw its content into the image (you want this for the special effect of the tool bar item and tab bar item).
...put all this together and tweak it to your special needs and you will have an animation that resembles the animation you are looking for.

Related

How to build below screen in titanium?

below i attached an app help guide screen. I am understanding how to build this screen.
If any body have idea please share here
View with semi transparent background color (backgroundColor:"rgba(0,0,0,0.5)";) and some images on top of it.
So, using images is bad. You'll need images for translations and if you do this as one image you'll need to ensure all devices are covered so your arrows point to the right element.
Minimise images == smaller app.
First thing you'll need to do is a create a blocker view -- so that's a view that will fill the screen and have a black background with opacity.
You can't apply that to the window as everything in it will be semi-transparent so:
Create a transparent Window that fills the screen.
Add to that window a view that fills the window and has opacity say 0.5 and black background
Add to the Window (not the view you just created) the other elements and button -- ideally, these should be individual graphics of the arrows, sized in such a way that you can position them based on the host element (the item they are pointing to / referring to). Use real text so you can handle translations / reduce file size.
So you'll need a way to associate each tip with a control they are anchored too, and that will ensure that regardless of the screen size, the tip will appear in the correct place.
First of all, always give a try before putting questions anywhere because it makes you learn things on your own for long time.
The easiest step for you to do this is to ask your designer to create a complete image just like that & you just have to show it on top.
If you have to show that image in different translations, then you can ask your designer to provide you required translations images.

Move Insertion point of an NSTextView and make the written content visible

I am working on one Mac app. In which I want to play few tricks with insertion point of an NSTextView.
![NSTextView with overlay on it][2]
What am I doing is, I have an NSTextView (The whole image screen is of NSTextView) and above that I have placed one overlay (as you can see at the bottom of the image). There are two Labels at the extreme Left and Right end and has a white gradient view too. All these three I have placed above NSTextView.
Now when User types in, textview gets scrolled and at one point, typed letters goes below the overlay.
I have to manage this stuff only. I want to keep track that user has reached to the overlay border and if yes, I want to move the insertion point to little upside so that user can see the content which he/she is writing.
Will anyone suggest me, how to make this possible ?
I have tried many things, but its not working. Kindly help.

Gradient button bar like the one found in Xcode 4

The bar I’m looking for is the separator bar between the editor area and the debug area:
Specifically, I want the buttons to have no borders and I want to have the vertical separator (to the left of ‘No Selection’).
I haven’t done any AppKit stuff in Mountain Lion yet, so before I start implementing my own custom control, I was wondering if I have overlooked a new control (or options for existing controls), or otherwise if somebody has already implemented a custom control that does this?
Its just NSButtons with a custom background image (which is the silver effect) and the "Image" which is the control image.
A quick look inside Xcode.app/Contents/OtherFrameworks/DevToolsInterface.framework/Versions/A/Resources will show you the relevant images.

iOS page based application clear color issue

I'm trying to make a page based application in iOS where the actual page is a non-rectangular image (contains clear color). However, the shadow that appears when I turn the page doesn't seem to ignore the transparency of the image (see below).
Screenshot http://img543.imageshack.us/img543/9730/pagecurl.png
Does anyone know if it's possible to modify this behavior?
Thanks in advance.
Have you tried setting your UIPageViewController's view's frame so that it sits just within the border defined by your custom page image?
(So in your case, the largest rectangle that fits inside your white page image)
The way UIPageViewController handles a page curl animation with views that extend beyond its own view's frame can be thought of as follows:
Think of the overhang as rigid. it does not bend like the rest of the page, but it does maintain the angle at the edge of the UIPageViewController's frame. If the overhang (i.e. parts of your image or view that extend beyond the UIPageViewController's frame), is small, the fact that the overhang animates as rigid (instead of the bendy, flexible page) is visually negligible.
However, without any further modifications, the pages will only flip when a touch is started INSIDE the UIPageViewController's view's frame. But it would be better if it could react to touches anywhere on your white page image. If you want the pages to react to touches inside another view's frame (e.g. the view holding your white page image), try the following:
otherView.gestureRecognizers = myPageViewController.gestureRecognizers;
The problem is that the iOS framework puts a shadow over the entire bounds of the view controller you specify for the page, so any transparent areas will look shadowed. You could try masking your view controller (viewController.view.layer.mask and viewController.view.layer.masksToBounds) and see if that helps.
Hopefully Apple improves this framework for a future iOS release. It sure would be nice to disable that shadow or have a way to do it yourself but there you go.

Xcode/iTunes/Instruments central toolbar item; what's it called and how do I create one?

I'd like to create a toolbar item like the central item seen in Xcode/iTune/Instruments/etc:
Can anyone tell me what it's called and how to go about creating my own?
Also, will I face problems getting my app approved by Apple when I submit it to the Mac App Store, for imitating Apple's own apps too much?
I finally implemented the solution from here:
iTunes or Xcode style information box at top of window
Here are the initial results:
This is an Apple's private control, but you cannot create it as a NSToolbarItem. Check this other Q/A to know how to add a custom view in the window's main frame.
Is it possible to draw in the label area of NSToolbar?
I've noticed some interesting things about Instruments:
If you make the window narrow such that the overflow menu is triggered, the items in that menu are all blank.
You can't change the icon size or turn labels on/off.
Colors does not have a label when you add it to the toolbar.
The labels on Space, Flexible Space, and Colors do not line up with the other items' labels.
These are interesting because they seem to fit an idea I had for implementing this: turn labels off, and give all your items custom views, where normal-looking items actually have manually drawn labels. It would obviously be a lot of work, but it gives you enough freedom to effectively do full-height items.
The nice thing is that, unlike the view/window hack that Xcode seems to use, you still have a customizable toolbar with draggable items.