Showing posts with label ios7. Show all posts
Showing posts with label ios7. Show all posts

Tuesday, 25 February 2014

View Controller Transitions iOS7


If you like to learn about animatedtransitioning this is the best blog that I have find, explains it very well: http://www.objc.io/issue-5/view-controller-transitions.html


View Controller Transitions
Issue #5 iOS 7, October 2013
By Chris Eidhof

One of the most exciting iOS 7 features for me is the new View Controller Transitioning API. Before iOS 7, I would also create custom transitions between view controllers, but doing this was not really supported, and a bit painful. Making those transitions interactive, however, was harder.

Before we continue with the article, I’d like to issue a warning: this is a very new API, and while we normally try to write about best practices, there are no clear best practices yet. It’ll probably take a few months, at least, to figure them out. This article is not so much a recommendation of best practices, but rather an exploration of a new feature. Please contact us if you find out better ways of using this API, so we can update this article.

Before we look at the API, note how the default behavior of navigation controllers in iOS 7 changed: the animation between two view controllers in a navigation controller looks slightly different, and it is interactive. For example, to pop a view controller, you can now pan from the left edge of the screen and interactively drag the current view controller to the right.

That said, let’s have a look at the API. What I found interesting is the heavy use of protocols and not concrete objects. While it felt a bit weird at first, I prefer this kind of API. It gives us as programmers much more flexibility. First, let’s try to do a very simple thing: having a custom animation when pushing a view controller in a navigation controller (the sample project for this article is on github). To do this, we have to implement one of the new UINavigationControllerDelegate methods:

- (id<UIViewControllerAnimatedTransitioning>)
                   navigationController:(UINavigationController *)navigationController
        animationControllerForOperation:(UINavigationControllerOperation)operation
                     fromViewController:(UIViewController*)fromVC
                       toViewController:(UIViewController*)toVC
{
    if (operation == UINavigationControllerOperationPush) {
        return self.animator;
    }
    return nil;
}

Read the rest of the article here : http://www.objc.io/issue-5/view-controller-transitions.html



Monday, 24 June 2013

UIDocument does not allow you to write strings directly to disk

If you are using UIDocument in your app, always remember that UIDocument doesn't allow you to write strings directly to disk.

You need to package the string value in NSData then you can write it to disk. You can do it using the contentsForType:error method.

Below is a sample code, first check that the string is not NULL :

- (id)contentsForType:(NSString *)typeName error:(NSError **) myError{
    if (!self.stringDocument)
        self.stringDocument = @"";

    NSData *nsDataDocument = [self.stringDocument
                           dataUsingEncoding:NSUTF8StringEncoding];
    return nsDataDocument;
}

written by: infinitywebseo 

Wednesday, 12 June 2013

iOS 7 Beta a Quick Overview

iOS 7 Beta has so many bugs but the idea is great, its basically amazing. Can't wait for the final version.




written by: infinitywebseo