Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 在图像地图上书写或绘制文本_Ios_Objective C_Uiimage_Imagemap - Fatal编程技术网

Ios 在图像地图上书写或绘制文本

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

我已经创建了一个图像地图,其中包含scrollview中的imageview,在我的imageview中,如果触摸特定部分,那么我想在该特定部分上绘制文本


有图书馆吗

您可以通过首先获得触摸点自己完成此操作,如下所示:

- (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];
根据要对文本字段执行的操作,您可以创建一个对象。并保存到一个数组中。你明白了