xcode의 맵킷에 있는 재설정 버튼 및 책갈피 버튼 (A Reset button and a bookmark button in mapkit in xcode)


문제 설명

xcode의 맵킷에 있는 재설정 버튼 및 책갈피 버튼 (A Reset button and a bookmark button in mapkit in xcode)

현재 mapkit과 관련된 애플리케이션을 개발 중입니다. 프로그램을 열 때 보기를 기본 보기로 재설정하는 재설정 버튼을 보기에 추가하고 싶습니다. 더 나은 방법은 앱을 열고 닫을 때 맵킷이 자체적으로 재설정된다는 것입니다.

코드 다음과 같이 초기 영역을 설정하는 데 사용했습니다:

    MKCoordinateRegion region = { {0.0, 0.0 }, { 0.0, 0.0 } };
region.center.latitude = 54.049929;
region.center.longitude = ‑4.54834;
region.span.longitudeDelta = 4.5;
region.span.latitudeDelta = 4.5;
[mapView setRegion:region animated:YES];

도움을 주시면 감사하겠습니다.


참조 솔루션

방법 1:

Store the Location of your map In .h file

CLLocationCoordinate2D location;

When setting initial Region

location.latitude = 54.049929;
location.longitude = ‑4.54834;

In your Reset Button

MKCoordinateRegion region = { {0.0, 0.0 }, { 0.0, 0.0 } };
region.center.latitude = location.latitude
region.center.longitude = location.longitude;
region.span.longitudeDelta = 4.5;
region.span.latitudeDelta = 4.5;
[mapView setRegion:region animated:YES];

방법 2:

So, are you trying to figure out how to actually add the button to the view and link it to a method in the code?

The code itself within the method would just be the same as you used for your initial setup, as indicated by BuildSucceded above ...

You should just add a button to the toolbar/navbar(if you have one), and link it to a "resetMap()" method.

(by Joniprabarob)

참조 문서

  1. A Reset button and a bookmark button in mapkit in xcode (CC BY‑SA 3.0/4.0)

#XCode #iphone #objective-c #mapkit #uibutton






관련 질문

xcode를 사용하여 OSX 화면 보호기로 플래시 파일 (Flash file as OSX screensaver using xcode)

ARC를 사용하여 VM:ImageIO_GIF_Data를 릴리스하는 방법은 무엇입니까? (How to release VM:ImageIO_GIF_Data using ARC?)

탐색 컨트롤러로 보기로 돌아가기 위해 자동 제스처를 끄는 방법은 무엇입니까? (How to turn off the automatic gesture to go back a view with a navigation controller?)

레코드 삭제 중 오류 발생, 포착되지 않은 예외 'NSInternalInconsistencyException'으로 인해 앱 종료 (error while deleting records,Terminating app due to uncaught exception 'NSInternalInconsistencyException')

xcode 7 시뮬레이터 또는 장치에서 앱을 실행하는 방법은 무엇입니까? (how to run app on xcode 7 simulator or device?)

언래핑 라인을 잡고 잡으시겠습니까? 스위프트 2.0, XCode 7 (Try and catch around unwrapping line? Swift 2.0, XCode 7)

MKMapView 폐색이 주석을 제거합니까? (Does MKMapView occlusion cull it's annotations?)

Objective C의 didFinishLoading에서 IndexPath.row를 얻는 방법 (how to get IndexPath.row in didFinishLoading in Objective C)

xcode의 맵킷에 있는 재설정 버튼 및 책갈피 버튼 (A Reset button and a bookmark button in mapkit in xcode)

Swift 패키지 관리자: 소프트웨어 업데이트 후 정적 빌드 실패 (Swift Package manager : static build failing after software updates)

문서화 오류 Jazzy "0% 문서화되지 않은 기호가 포함된 문서 적용 범위" (documenting error Jazzy "0% documentation coverage with 0 undocumented symbols")

Swift 5에서 Subscript의 모호한 사용? (Ambiguous use of Subscript in Swift 5?)







코멘트