作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这是我添加 map 和 UISearchBar
的代码,但是在 View 中看不到我的搜索栏。
-(void)setCamera {
camera = [GMSCameraPosition cameraWithLatitude:currentLatitude
longitude:currentLongitude
zoom:8];
mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
mapView_.myLocationEnabled = YES;
searchBar = [[UISearchBar alloc]initWithFrame:CGRectZero];
searchBar.frame = CGRectMake(0, 10, 100, searchBar.frame.size.height);
[mapView_ addSubview:searchBar];
self.view = mapView_;
}
最佳答案
//create a search bar with 0 width and 0 height
searchBar = [[UISearchBar alloc]initWithFrame:CGRectZero];
//set the frame to 0 height because line above sets the height to zero.
searchBar.frame = CGRectMake(0, 10, 100, searchBar.frame.size.height);
//maybe something like this?
searchBar.frame = CGRectMake(0, 10, 100, 44);
关于ios - 我将如何在 iOS 的谷歌地图中添加搜索栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20696007/
leaflet:一个开源并且对移动端友好的交互式地图 JavaScript 库 中文文档: https://leafletjs.cn/reference.html 官网(英文): ht
我是一名优秀的程序员,十分优秀!