gpt4 book ai didi

iphone - LinkedIn 菜单 iPhone 应用程序

转载 作者:可可西里 更新时间:2023-11-01 03:59:38 25 4
gpt4 key购买 nike

我想开发一个带有菜单的应用程序,它看起来像 ios Linkedin 应用程序。像这样(左图)

enter image description here

有 4 个瞥见(微缩模型)与四个主要 View 相关联。并且缩图始终显示 View 的更新状态。

我想知道我们可以做这样的菜单吗?

在此先感谢您的帮助!

塞巴斯蒂安 ;)


那么为什么要将 4 个 UIView 放在另一个 UIView 中而不是直接放在 UIViewController 中呢?你谈到了按钮,但你的例子中只有 UIView ?我想知道这 4 个按钮是否在 4 个 View 上并且是透明的以便应用转换。

您有转换的代码示例吗?

非常感谢您的帮助!

最佳答案

- (void)viewDidLoad {
[super viewDidLoad];
[self.navigationItem setTitle:@"About us"];

presentationViewController = [[PresentationViewController alloc] initWithNibName:@"PresentationViewController" bundle:nil];
secteursViewController = [[SecteursViewController alloc] initWithNibName:@"SecteursViewController" bundle:nil];
engagementsViewController = [[EngagementsViewController alloc] initWithNibName:@"EngagementsViewController" bundle:nil];
interviewsViewController = [[InterviewsViewController alloc] initWithNibName:@"InterviewsViewController" bundle:nil];

presentationApercu = presentationViewController.view;
secteursApercu = secteursViewController.view;
videosApercu = interviewsViewController.view;
engagementsApercu = engagementsViewController.view;

presentationApercu.transform = CGAffineTransformMakeScale(1/(320./107), 1/(367./122.));
presentationApercu.frame = CGRectMake(27., 18., presentationApercu.frame.size.width, presentationApercu.frame.size.height);

secteursApercu.transform = CGAffineTransformMakeScale(1/(320./107), 1/(367./122.));
secteursApercu.frame = CGRectMake(185., 18., secteursApercu.frame.size.width, secteursApercu.frame.size.height);

videosApercu.transform = CGAffineTransformMakeScale(1/(320./107), 1/(367./122.));
videosApercu.frame = CGRectMake(27., 196., videosApercu.frame.size.width, videosApercu.frame.size.height);;

engagementsApercu.transform = CGAffineTransformMakeScale(1/(320./107), 1/(367./122.));
engagementsApercu.frame = CGRectMake(185., 196., engagementsApercu.frame.size.width, engagementsApercu.frame.size.height);

presentationApercu.tag = 1;
secteursApercu.tag = 2;
videosApercu.tag = 3;
engagementsApercu.tag = 4;

UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(zoomAction:)];
[tap setNumberOfTapsRequired:1];
[presentationApercu addGestureRecognizer:tap];
[tap release];

tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(zoomAction:)];
[tap setNumberOfTapsRequired:1];
[secteursApercu addGestureRecognizer:tap];
[tap release];

tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(zoomAction:)];
[tap setNumberOfTapsRequired:1];
[videosApercu addGestureRecognizer:tap];
[tap release];

tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(zoomAction:)];
[tap setNumberOfTapsRequired:1];
[engagementsApercu addGestureRecognizer:tap];
[tap release];

[self.view addSubview:presentationApercu];
[self.view addSubview:secteursApercu];
[self.view addSubview:videosApercu];
[self.view addSubview:engagementsApercu];

}


#pragma mark - IBActions

- (void)zoomReverse {
[self.navigationItem setLeftBarButtonItem:nil];
UITapGestureRecognizer *tap = nil;

switch (tagEnCours) {
case 1:
[self.view bringSubviewToFront:presentationApercu];

tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(zoomAction:)];
[tap setNumberOfTapsRequired:1];
[presentationApercu addGestureRecognizer:tap];
[tap release];

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];

presentationApercu.transform = CGAffineTransformMakeScale(1/(320./107), 1/(367./122.));
presentationApercu.frame = CGRectMake(27., 18., presentationApercu.frame.size.width, presentationApercu.frame.size.height);

[UIView commitAnimations];

break;

case 2:
[self.view bringSubviewToFront:secteursApercu];

tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(zoomAction:)];
[tap setNumberOfTapsRequired:1];
[secteursApercu addGestureRecognizer:tap];
[tap release];

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];

secteursApercu.transform = CGAffineTransformMakeScale(1/(320./107), 1/(367./122.));
secteursApercu.frame = CGRectMake(185., 18., secteursApercu.frame.size.width, secteursApercu.frame.size.height);

[UIView commitAnimations];

break;

case 3:
[self.view bringSubviewToFront:videosApercu];

tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(zoomAction:)];
[tap setNumberOfTapsRequired:1];
[videosApercu addGestureRecognizer:tap];
[tap release];

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];

videosApercu.transform = CGAffineTransformMakeScale(1/(320./107), 1/(367./122.));
videosApercu.frame = CGRectMake(27., 196., videosApercu.frame.size.width, videosApercu.frame.size.height);

[UIView commitAnimations];

break;

case 4:
[self.view bringSubviewToFront:engagementsApercu];

tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(zoomAction:)];
[tap setNumberOfTapsRequired:1];
[engagementsApercu addGestureRecognizer:tap];
[tap release];

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];

engagementsApercu.transform = CGAffineTransformMakeScale(1/(320./107), 1/(367./122.));
engagementsApercu.frame = CGRectMake(185., 196., engagementsApercu.frame.size.width, engagementsApercu.frame.size.height);

[UIView commitAnimations];

break;

default:
break;
}
}

- (void)zoomAction:(UITapGestureRecognizer *)sender {
[self.navigationItem setLeftBarButtonItem:[[[UIBarButtonItem alloc] initWithTitle:@"About us" style:UIBarButtonItemStyleDone target:self action:@selector(zoomReverse)] autorelease]];
tagEnCours = sender.view.tag;
switch (sender.view.tag) {
case 1:
[self.view bringSubviewToFront:presentationApercu];
[presentationApercu removeGestureRecognizer:[presentationApercu.gestureRecognizers objectAtIndex:0]];

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];

presentationApercu.transform = CGAffineTransformIdentity;
presentationApercu.frame = CGRectMake(0., 0., presentationApercu.frame.size.width, presentationApercu.frame.size.height);

[UIView commitAnimations];

break;

case 2:
[self.view bringSubviewToFront:secteursApercu];
[secteursApercu removeGestureRecognizer:[secteursApercu.gestureRecognizers objectAtIndex:0]];

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];

secteursApercu.transform = CGAffineTransformIdentity;
secteursApercu.frame = CGRectMake(0., 0., secteursApercu.frame.size.width, secteursApercu.frame.size.height);

[UIView commitAnimations];
break;

case 3:
[self.view bringSubviewToFront:videosApercu];
[videosApercu removeGestureRecognizer:[videosApercu.gestureRecognizers objectAtIndex:0]];

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];

videosApercu.transform = CGAffineTransformIdentity;
videosApercu.frame = CGRectMake(0., 0., videosApercu.frame.size.width, videosApercu.frame.size.height);

[UIView commitAnimations];
break;

case 4:
[self.view bringSubviewToFront:engagementsApercu];
[engagementsApercu removeGestureRecognizer:[engagementsApercu.gestureRecognizers objectAtIndex:0]];

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];

engagementsApercu.transform = CGAffineTransformIdentity;
engagementsApercu.frame = CGRectMake(0., 0., engagementsApercu.frame.size.width, engagementsApercu.frame.size.height);

[UIView commitAnimations];
break;

default:
break;
}
}

关于iphone - LinkedIn 菜单 iPhone 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10030603/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com