如何检测MKPolyline是否与自身相交?我试过研究这个,但只发现有两行或更多行的问题.如何检测我是否只有一行/一笔?我希望在用户释放触摸后检测到它.
我目前在touchEnded函数中有这个代码.
CGPoint location = [touch locationInView:self.mapView];
CLLocationCoordinate2D coordinate = [self.mapView convertPoint:location toCoordinateFromView:self.mapView];
[self.coordinates addObject:[NSValue valueWithMKCoordinate:coordinate]];
NSInteger numberOfPoints = [self.coordinates count];
if(numberOfPoints > 2)
{
[self setLineLength:[self getLengthArea]];
if([self lineLength] < 401)
{
if (numberOfPoints > 2)
{
CLLocationCoordinate2D points[numberOfPoints];
for (NSInteger i = 0; i < numberOfPoints; i++) {
points[i] = [self.coordinates[i] MKCoordinateValue];
}
[self.mapView addOverlay:[MKPolyline polylineWithCoordinates:points count:numberOfPoints]];
}
PCAnnotation *ann = [[PCAnnotation alloc] init];
[ann setCoordinate:coordinate];
ann.title = @"End";
[self.mapView addAnnotation:ann];
}
else
{
NSArray *overlayItems = [self.mapView …Run Code Online (Sandbox Code Playgroud) 我的页面中有一个数据表,其中包含状态列和视图详细信息列.单击视图详细信息后,它将弹出一个模态,模态包含一个状态下拉列表,当更改时,数据库中的某个值将更改.但是,在关闭模态后,数据表中的值不会更改.如何重新加载数据表而不重新初始化它,或者如何获取我单击的列和行,以便我可以更改某个列和行的值.我有这个代码用于初始化doc.ready上的数据表
function createTable(data){
for (i in data){
var message = "<tr>";
var statusHolder = "";
if(data[i].status == "open"){
statusHolder = "Open";
} else if (data[i].status == "resolved"){
statusHolder = "Resolved";
} else {
statusHolder = "Closed";
}
var id = data[i].id;
message+= "<td>" + statusHolder + "</td>";
message+= "<td><input id = 'ticketId' type ='hidden' value = " + data[i].id +" /><input type = 'hidden' id = 'support-type-name' value = 'call-back'/><a href='javascript:retrieveCommentsInfo(" + data[i].id +")' id='view-ticket-info'>" + " View details" + …Run Code Online (Sandbox Code Playgroud)