简体   繁体   中英

Search As in IOS8 Calender app

I'm wondering how i can achieve the same search function as in the calender app. When u click the RightBarButton then a new navigationBar with the searchBar animate on top of the existing and hwn u click cancel it will animate away. I guess this is a UISearchDisplayController which appears on the top, but how can i do something like this?

Here u see an illustration so when u click searchButton searchBar appear from the top and when u press done it animates away again.

在此处输入图片说明

You should try to show the search bar by using:

At tap:

    [UIView animateWithDuration:.5 delay:0.0 options:UIViewAnimationOptionCurveEaseIn animations:^{
        _collectionView.center = CGPointMake(160, 700);
    } completion:^(BOOL finished) {
        [self presentViewController:clockTappedController animated:NO completion:nil];
    }];

In viewWillAppear:

[UIView animateWithDuration:.5 delay:0.0 options:UIViewAnimationOptionCurveEaseIn animations:^{
            _collectionView.center = CGPointMake(160, 528);

        }
        completion:^(BOOL finished) {
        }];

I've used it for collection view, but i think that you can do the same using the searchbar.

Loading the searchbar off of the screen and then get it slide down at tap on the icon. When you tap on done you put again the searchbar off the screen.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM