具体的效果就是点击callout中的rightCalloutAccessoryView(一个button)后,callout窗口以动画效果缩小,消失后又逐渐展开一个Popover.
我的代码是这样的: - (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView<MKAnnotation> *)view calloutAccessoryControlTapped:(UIControl *)control { //[view dismissModalViewControllerAnimated:YES]; NSArray *anns = [[NSArray alloc] initWithArray:[_mapView selectedAnnotations]]; if ([anns count] > 0) { //[[anns objectAtIndex:0] setSelected:NO animated:YES]; [_mapView deselectAnnotation:[anns objectAtIndex:0] animated:YES]; } [anns release]; ...... cmccDetailController = [[CmccDetailController alloc]initWithNibName:@"CmccDetailController" bundle:nil]; cmccDetailController.contentSizeForViewInPopover = CGSizeMake(490,200); detailPopoverController = [[UIPopoverController alloc] initWithContentViewController:cmccDetailController]; // [detailPopoverController setPopoverContentSize:CGSizeMake(400,280)]; [detailPopoverController presentPopoverFromRect:rect inView:mapView permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; 问题一:为什么[_mapView deselectAnnotation:[anns objectAtIndex:0] animated:YES];与[detailPopoverController presentPopoverFromRect:rect inView:mapView permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; 的animated参数都为YES了运行起来又没有动画效果? 问题二:如何实现googlemap中callout和popover的动画效果? 先谢谢各位了. 找到了这个 http://www.cocoachina.com/bbs/read.php?tid-11820-fpage-3.html,学习了.
谢谢cocoachina. 解决了,在ContentViewController的viewDidAppear:方法里加入动画即可.
-(void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; self.contentSizeForViewInPopover = CGSizeMake(335, 0); [UIView beginAnimations:@"animationID" context:nil]; [UIView setAnimationDuration:0.5]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationRepeatAutoreverses:NO]; CGSize contentSize; contentSize.width = self.contentSizeForViewInPopover.width; contentSize.height = 192; self.contentSizeForViewInPopover = contentSize; [UIView commitAnimations]; } 我按着您的方法做了一下,点callout的rightCalloutAccessoryView, 展开了一个popover, 这个时候如果进行横屏和竖屏的切换,展开的popover的位置就乱了,而不像google map里面一样,这是什么原因呢
|
(转载)如何实现ipad中googlemap的callout和Popover的动画效果
转载本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
有趣的CSS - 文字加载动画效果
用 css 实现多字符模拟加载动画效果。
css 加载动画 交互 ux 动效 -
有趣的css - 打字机动画效果
使用 css 实现好玩的单行打字机效果,和我一起看看吧。
动效设计 交互设计 ux/ui 打字机动画 -
【Phaser游戏开发】动画效果-舞动的蝴蝶环
舞动的蝴蝶圆环,蝴蝶群飞舞
Game Phaser 舞动的蝴蝶圆环 蝴蝶群飞舞 -
css和JavaScript实现的星云动画效果
要获取更多Jerry的原创文章,请关注公众号"汪子熙":
JavaScript 公众号 -
Animation动画效果的实现
提供了三种动画效果:逐帧动画(frame-by-frame animation),这种动画和GIF一样,一帧
Android OPhone 360 QQ XML