滑动UIView以部分覆盖另一个UIView [英] Sliding a UIView to partially overlay another UIView

查看:95
本文介绍了滑动UIView以部分覆盖另一个UIView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从我一直在寻找如上所述的动画以来已经过了几个小时。到目前为止,我已经在honcheng找到了这个折叠导航,这很酷。但是,我想要的比这更简单。谷歌地图从右侧带出的方式,这就是我希望减去翻页效果。某种程度上像iPad的 Pulse 新闻的方式也很棒。

It's been a couple of hours since I've been searching on how to do the animation as stated above. So far, I've found this folding navigation by honcheng and it's quite cool. However, what I want is a bit simpler than this. The way the google map is being brought out from the right side, that's what I wish minus the flipping page effect. Somehow like the way Pulse news for iPad does which is also awesome.

所以是的,如果有人这样做了,你能否提出一些关于我如何能够学到这一点的想法。或者也许是我可以看到的开源,并改为进行逆向工程。

So yeah, if anyone has done this, can you suggest some ideas on how can I learn this. Or perhaps an open source which I could look on, and do reverse engineering instead.

推荐答案

这应该对你有帮助,尽管保持我不太熟悉Pulse中使用的动画。

This should help you, although keep in mind I'm not very familiar with the animations used in Pulse.

.h声明一个名为secondView的 UIView

.h declare a UIView named secondView.

- (void)viewDidLoad
{
    [super viewDidLoad];
    secondView = [[UIView alloc] initWithFrame:CGRectMake(320, 0, 320, 480)];
    [secondView setBackgroundColor:[UIColor redColor]];
    [self.view addSubview:secondView];
}

- (IBAction)myAction:(id)sender
{
    [UIView animateWithDuration:0.45 animations:^{
        if (secondView.transform.tx == 0) {
            [secondView setTransform:CGAffineTransformMakeTranslation(-200, 0)];
        }else{
            [secondView setTransform:CGAffineTransformMakeTranslation(0, 0)];
        }

    }];
}

然后只需将此操作链接到一个不会被您阻止的按钮新来的观点!

Then simply link this action to a button that won't be blocked by your new incoming view!

这篇关于滑动UIView以部分覆盖另一个UIView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆