显示已禁用的选项元素 - html下拉表单(display disabled option element - html drop down form)
我有一个下拉html表单,并希望显示
disabled=disabled
元素(查看下面的编辑)
首先看一下,表单会跳过disabled
元素并显示“选项1”。<select> <option disabled='disabled'>Title</option> <option>Option 1</option> <option>Option 2</option> <option>Option 3</option> </select>
这只能用
html
或css
吗?
如果不是那么jQuery
或javascript
怎么样?编辑
希望表单看起来像这样
目前它看起来像I have a drop down html form and would like to display the
disabled=disabled
element (view the edit below)
At first initial glance, the form skips thedisabled
element and displays "option 1".<select> <option disabled='disabled'>Title</option> <option>Option 1</option> <option>Option 2</option> <option>Option 3</option> </select>
Is this possible with just
html
orcss
?
If not then how aboutjQuery
orjavascript
?Edit
Would like the form to look like this
Currently it looks like
原文:https://stackoverflow.com/questions/14630672
最满意答案
您可以使用自定义视图为每个注释使用一个
UIView
,一个UIImageView
和一个标签显示不同的值。 这将在方法内完成- (MKAnnotationView *)mapView:(MKMapView *)newMapView viewForAnnotation:(id )newAnnotation
。 您必须将UIView
的大小设置为透明颜色的两倍,以便更精确地查看放大和缩小mapview中的内容。码 - - -
-(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { static NSString * const kPinAnnotationIdentifier = @"PinIdentifier"; if(annotation == self._mapView.userLocation) { return nil; } MyAnnotation *myAnnotation = (MyAnnotation *)annotation; MKAnnotationView *newAnnotation = (MKAnnotationView*)[self._mapView dequeueReusableAnnotationViewWithIdentifier:kPinAnnotationIdentifier]; if(!newAnnotation){ newAnnotation = [[MKAnnotationView alloc] initWithAnnotation:myAnnotation reuseIdentifier:@"userloc"]; } NSDictionary *dict=[alertInfoArray objectAtIndex:myAnnotation.ann_tag]; UIView *anView=[[UIView alloc] init]; anView.backgroundColor=[UIColor clearColor]; UIImageView *bgImg=[[UIImageView alloc] init]; bgImg.image=[UIImage imageNamed:@""]; bgImg.backgroundColor=[UIColor clearColor]; UIImageView *imgView=[[UIImageView alloc] init]; imgView.tag=myAnnotation.ann_tag; UILabel *lblName=[[UILabel alloc] init]; lblName.font=[UIFont systemFontOfSize:12]; lblName.textAlignment=UITextAlignmentCenter; lblName.textColor=[UIColor whiteColor]; lblName.backgroundColor=[UIColor clearColor]; lblName.text=TEXT YOU WANT ; newAnnotation.frame=CGRectMake(0, 0, 70, 212); anView.frame=CGRectMake(0, 0, 70, 212); bgImg.frame=CGRectMake(0, 0, 70, 106); bgImg.image=[UIImage imageNamed:@"thumb-needhelp.png"]; imgView.frame=CGRectMake(8,25,55,48); imgView.image=[UIImage imageNamed:@"girl-default.png"]; lblName.frame=CGRectMake(5,79,60,10); [anView addSubview:bgImg]; [bgImg release]; [anView addSubview:imgView]; [imgView release]; [newAnnotation addSubview:anView]; [anView release]; newAnnotation.canShowCallout=YES; [newAnnotation setEnabled:YES]; return newAnnotation; }
希望这可以帮助。
You can use custom view for each annotation with one
UIView
, oneUIImageView
and one Label to display different value. This will be done within the method- (MKAnnotationView *)mapView:(MKMapView *)newMapView viewForAnnotation:(id )newAnnotation
. You have to takeUIView
double in size with transparent color with respect toUIImageView
to make more precise view on zoom in and zoom out in mapview.Code-----
-(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { static NSString * const kPinAnnotationIdentifier = @"PinIdentifier"; if(annotation == self._mapView.userLocation) { return nil; } MyAnnotation *myAnnotation = (MyAnnotation *)annotation; MKAnnotationView *newAnnotation = (MKAnnotationView*)[self._mapView dequeueReusableAnnotationViewWithIdentifier:kPinAnnotationIdentifier]; if(!newAnnotation){ newAnnotation = [[MKAnnotationView alloc] initWithAnnotation:myAnnotation reuseIdentifier:@"userloc"]; } NSDictionary *dict=[alertInfoArray objectAtIndex:myAnnotation.ann_tag]; UIView *anView=[[UIView alloc] init]; anView.backgroundColor=[UIColor clearColor]; UIImageView *bgImg=[[UIImageView alloc] init]; bgImg.image=[UIImage imageNamed:@""]; bgImg.backgroundColor=[UIColor clearColor]; UIImageView *imgView=[[UIImageView alloc] init]; imgView.tag=myAnnotation.ann_tag; UILabel *lblName=[[UILabel alloc] init]; lblName.font=[UIFont systemFontOfSize:12]; lblName.textAlignment=UITextAlignmentCenter; lblName.textColor=[UIColor whiteColor]; lblName.backgroundColor=[UIColor clearColor]; lblName.text=TEXT YOU WANT ; newAnnotation.frame=CGRectMake(0, 0, 70, 212); anView.frame=CGRectMake(0, 0, 70, 212); bgImg.frame=CGRectMake(0, 0, 70, 106); bgImg.image=[UIImage imageNamed:@"thumb-needhelp.png"]; imgView.frame=CGRectMake(8,25,55,48); imgView.image=[UIImage imageNamed:@"girl-default.png"]; lblName.frame=CGRectMake(5,79,60,10); [anView addSubview:bgImg]; [bgImg release]; [anView addSubview:imgView]; [imgView release]; [newAnnotation addSubview:anView]; [anView release]; newAnnotation.canShowCallout=YES; [newAnnotation setEnabled:YES]; return newAnnotation; }
Hope this helps.
相关问答
更多-
为此,您可以使用didSelectAnnotationView选定Annotation ,然后将该注释存储到实例变量中,然后在Button操作方法中使用注释。 var selectedAnnotation: MKPointAnnotation? func mapView(mapView: MKMapView, didSelectAnnotationView view: MKAnnotationView) { self.selectedAnnotation = view.annotation as? ...
-
Swift使用AlertController在mapView上添加注释(Swift Use AlertController to add annotation on mapView)[2023-08-12]
只需在UIAlertController Presentation之前存储触点,并在UIAlterAction中使用触点,因为当警报弹出/呈现时,longpress无法保存/获取触点,因此UIAlterAction内的触点始终为0,0。 func longpress(gestureRecognizer: UIGestureRecognizer) { let touchpointtemp = gestureRecognizer.location(in: self.map_home) let alert = ... -
我相信你需要为你的气球创建一个布局。 在本教程中 ,作者创建了一个气球视图并具有balloon.xml。要显示图像,您需要将正确的图像视图放在XML文件中。 有点像尝试在列表视图中显示文本和图像,您需要行的布局。 除非我错过了,否则你需要在你的R.id.balloon_main_layout定义它 您甚至可能需要创建一个扩展OverlayItem的类,因为地图上的每个项目可能都有与之关联的不同图片。 如果您创建一个扩展OverlayItem的项目,那么您可以传入图片或具有在创建叠加层时检索图片的功能。 编辑 ...
-
UIViews使用Core Animation CALayer作为他们的支持,这确实是使用GPU绘制的。 我不熟悉MapKit,但很可能是Annotation被渲染为它所覆盖的地图图块的一部分,这意味着当你移动它时,系统将不得不重新绘制受影响的地图图块。 UIViews use a Core Animation CALayer as their backing, and that is indeed drawn using the GPU. I’m not familiar with MapKit, but ...
-
发生这种情况是因为您没有在plist中输入,如下所示。 如果仍然无效,请将代码更新到下面。 myMapView.delegate = self; locationManager.delegate = self; self.locationManager = [[CLLocationManager alloc] init]; #ifdef __IPHONE_8_0 if(IS_OS_8_OR_LATER) { // Use one or the other, not both. Depending o ...
-
如何在iPhone中使用图像和标签在Mapview中添加注释?(How to add annotation in Mapview with image and label in IPhone?)[2024-02-24]
您可以使用自定义视图为每个注释使用一个UIView ,一个UIImageView和一个标签显示不同的值。 这将在方法内完成- (MKAnnotationView *)mapView:(MKMapView *)newMapView viewForAnnotation:(id )newAnnotation 。 您必须将UIView的大小设置为透明颜色的两倍,以便更精确地查看放大和缩小mapview中的内容。 码 - - - -(MKAnnotationView *)mapView:(MKMapView *)ma ... -
我在类似你的案件中所做的是: 1)首先删除所有注释 for (id
anAnnotation in [NSArray arrayWithArray:mapView_.annotations]) { [mapView_ removeAnnotation:anAnnotation]; } 2)然后绘制所选的: [mapView_ addAnnotation:myAnnotation]; What I'm doing in a case similar to yours, ... -
iPhone - 向MapView添加自定义MKAnnotation不会被添加(iPhone - adding custom MKAnnotation to MapView does not get added)[2022-08-24]
弄清楚它是什么,所有代码都是正确的,但是我试图从另一个类修改View Controller中的数据,所以我正在做[self.storyboard instantiate...@""]但是这是创建另一个对象并修改它而不是修改原始视图控制器。 谢谢mattgalloway和西里尔! Figured out what it was, all of the code was correct, however I was trying to modify data in the View Controller fro ... -
调整图像大小以适应MapView的leftCalloutAccessoryView(Resizing image to fit in MapView's leftCalloutAccessoryView)[2023-09-06]
您可以尝试将UIImageView大小设置为创建的MKPinAnnotationView 然后调用方面适合它就像这样: let imageView = UIImageView(frame: CGRect(x: 0, y: 0, width: annotationView!.frame.height, height: annotationView!.frame.height)) imageView.image = UIImage(named: "TTT") imageView.contentMode = . ... -
你的代码对我来说看起来很好。 我怀疑你的委托赋值和mapView:viewForAnimation有一个错误mapView:viewForAnimation实际上没有调用mapView:viewForAnimation 。 没有提供该功能的委托的MKMapView将正常工作,所有注释都带有红色引脚。 尝试添加一些NSLog语句或在调试器中设置断点,以确保您实际执行此代码。 您可能已经知道这一点,但使用您自己的图像将需要您创建MKAnnotationView而不是MKAnnotationPinView的引脚。 ...