(转载)如何实现ipad中googlemap的callout和Popover的动画效果
2012-07-11 19:38
267 查看
具体的效果就是点击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里面一样,这是什么原因呢 |
相关文章推荐
- GoogleMap_IOS MKMapView如何实现不点击大头针,就可以出现calloutView效果
- 如何实现一个原质化菜单项或按钮HTML5动画效果
- activity跳转的时候如何实现动画效果
- swiper如何实现动画效果-小练习初级入门
- 如何使用CSS3的transition实现动画效果?
- css3 | 中的animation/@keyframes xz动画效果-如何使用纯css实现动画效果? 用法:animation:xz 3s 2 4s alternate; 参数:animati
- jquery的animate动画效果函数用JS代码是如何实现的
- Android中如何使用rotate实现图片不停旋转的效果与动画的停止
- iOS AutoLayout Constraint如何实现动画效果
- HTML中如何使用JavaScript实现DOM的动画效果
- listview如何加载动画,实现每个item都有效果
- Android自定义View: 如何实现类钟摆的动画效果?
- WPF如何实现类似iPhone界面切换的效果(转载)
- Blend中如何自定义控件模版,实现“vista button动画效果”(附图)
- 如何实现点击页面菜单图片替换并且有动画效果
- 如何实现Activity退出到桌面时的动画效果
- jquery实现返回顶部按钮和scroll滚动功能[带动画效果] 转载
- JavaScript动画效果是如何实现的
- Unity3D 4.x如何实现动画的Ping Pong效果
- 如何简单的实现一个tab页title的动画效果