gpt4 book ai didi

ios - 通过导航栏查看部分内容(类似 Feedly 应用程序)

转载 作者:行者123 更新时间:2023-11-28 20:23:32 26 4
gpt4 key购买 nike

我有一个可以与过滤器一起订购的 UITableView。我不想使用模态视图,而是只想制作一个来自屏幕左侧并部分覆盖我的 tableView 的 View 的动画。

这是我希望“过滤器 View ”看起来像的示例:

没有过滤器:

Without the filter

使用过滤器:

With the filter

有什么办法?

最佳答案

使用可重用代码的正确方法:

将动画类别添加到UIView

@interface UIView (MyAnimation)
-(void)slideInWithDuration:(NSTimeInterval)duration;

//implementation

-(void)slideInWithDuration:(NSTimeInterval)duration
{
CGRect screenRect = [[UIScreen mainScreen] bounds];
float nSpace = 0.0f //put any value you think right
CGFloat extraOffset = self.view.frame.size.width / 2 + nSpace;

CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position"];
animation.fromValue = [NSValue valueWithCGPoint:CGPointMake(screenRect.origin.x - extraOffset, self.view.center.y)];
animation.toValue = [NSValue valueWithCGPoint:self.view.center];
animation.duration = duration;
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];

[self.layer addAnimation:animation forKey:@"SlideInAnimation"];
}

SomeWhereViewController.m

UIWindow *mainWindow = [[UIApplication sharedApplication] keyWindow];
UIView *someView = [[UIView alloc] init];
someView.frame = // customize to your like
[mainWindow addSubview:someView];

[someView slideInWithDuration:0.7];

希望对您有所帮助!

关于ios - 通过导航栏查看部分内容(类似 Feedly 应用程序),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14994462/

26 4 0