首页 > 移动平台 > 详细

ios开发-------将一个tablevirew塞进callout中

时间:2016-06-18 16:40:04      阅读:235      评论:0      收藏:0      [点我收藏+]

默认callout的只有一个title和detailtextlabel,所显示的信息量实在太小,虽然在地图中弹出一个小框显示一点关键信息很合理,但是有些客户需要框变大一点,信息量多一个那也是没有办法的。

效果:

技术分享

 

我采取的方法是直接将一个tableview塞进去,但是tableView根本不能直接塞进calliout中,但可以将一个view塞进callout,我用的方法就是将tableview加到一个view上,然后在塞进callout中,上代码:

                self.mapView.callout.accessoryButtonHidden = YES;
                self.mapView.callout.accessoryButtonType=UIButtonTypeCustom;
                self.mapView.callout.color=[UIColor whiteColor];
                self.mapView.callout.customView=nil;
                UIView*view=[UIView new];
                view.frame=CGRectMake(0, 0, 170, 170);
                view.backgroundColor=[UIColor redColor];
                [self.xtbTableView removeFromSuperview];
                //self.mapView.callout.customView=view;
                self.xtbTableView=nil;
                self.xtbTableView=[UITableView new];
                self.xtbTableView.frame=view.frame;
                [self.xtbTableView setBackgroundColor:[UIColor yellowColor]];
                self.xtbTableView.dataSource=self;
                self.xtbTableView.delegate =self;
                [self.xtbTableView reloadData];
                [view addSubview:self.xtbTableView];
                self.mapView.callout.customView=view;
                CGRect rect=  self.mapView.callout.customView.frame;
                [self.mapView.callout.customView setFrame:rect];
                [self.mapView.callout showCalloutAt:xtbPoint screenOffset:CGPointZero animated:NO];
                self.mapView.touchDelegate=self; 

ios开发-------将一个tablevirew塞进callout中

原文:http://www.cnblogs.com/sandyLovingCoding/p/5596247.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!