Ios 在图像地图上书写或绘制文本
我已经创建了一个图像地图,其中包含scrollview中的imageview,在我的imageview中,如果触摸特定部分,那么我想在该特定部分上绘制文本Ios 在图像地图上书写或绘制文本,ios,objective-c,uiimage,imagemap,Ios,Objective C,Uiimage,Imagemap,我已经创建了一个图像地图,其中包含scrollview中的imageview,在我的imageview中,如果触摸特定部分,那么我想在该特定部分上绘制文本 有图书馆吗 您可以通过首先获得触摸点自己完成此操作,如下所示: - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *aTouch = [touches anyObject]; CGPoint point = [aTouch lo
有图书馆吗 您可以通过首先获得触摸点自己完成此操作,如下所示:
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *aTouch = [touches anyObject];
CGPoint point = [aTouch locationInView:self];
CGFloat xPos = point.x;
CGFloat yPos = point.y;
}
然后使用这些信息,制作一个以x和y为参数的方法。并以编程方式创建UITextField
UITextField * textFieldRounded = [[UITextField alloc] initWithFrame:CGRectMake(inParameterX, inParameterY, 300, 50)];
textFieldRounded.textColor = [UIColor blackColor];
textFieldRounded.font = [UIFont systemFontOfSize:17.0];
textFieldRounded.backgroundColor = [UIColor clearColor];
textFieldRounded.autocorrectionType = UITextAutocorrectionTypeNo;
textFieldRounded.keyboardType = UIKeyboardTypeDefault;
textFieldRounded.returnKeyType = UIReturnKeyDone;
textFieldRounded.clearButtonMode = UITextFieldViewModeWhileEditing;
然后将其添加到视图中:
[self.view addSubview:textFieldRounded];
根据要对文本字段执行的操作,您可以创建一个对象。并保存到一个数组中。你明白了