Created
December 12, 2011 14:09
-
-
Save rdeguzman/1467359 to your computer and use it in GitHub Desktop.
SIGABBRT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Incident Identifier: 9B4092CD-579E-418D-820E-9DF35A900FD7 | |
CrashReporter Key: d4365cbed4fa63fb6536c6c6925416357a62e6e7 | |
Hardware Model: iPhone3,1 | |
Process: Philippines [10001] | |
Path: /var/mobile/Applications/AD401050-1A1F-404C-ADF6-A3600ABEF16B/Philippines.app/Philippines | |
Identifier: Philippines | |
Version: ??? (???) | |
Code Type: ARM (Native) | |
Parent Process: launchd [1] | |
Date/Time: 2011-12-11 11:29:45.768 -0800 | |
OS Version: iPhone OS 5.0.1 (9A405) | |
Report Version: 104 | |
Exception Type: EXC_CRASH (SIGABRT) | |
Exception Codes: 0x00000000, 0x00000000 | |
Crashed Thread: 0 | |
Last Exception Backtrace: | |
0 CoreFoundation 0x33fce8bf 0x33f15000 + 759999 | |
1 libobjc.A.dylib 0x3421e1e5 0x34215000 + 37349 | |
2 CoreFoundation 0x33fce5f5 0x33f15000 + 759285 | |
3 MapKit 0x37b9b39b 0x37b72000 + 168859 | |
4 Philippines 0x00009077 -[MapListViewController zoomToFitPoiAnnotations] (MapListViewController.m:846) | |
5 Philippines 0x000094a7 -[MapListViewController zoomToFitUserAnnotationAndCountry] (MapListViewController.m:875) | |
6 Philippines 0x00009853 -[MapListViewController newLocationUpdate:] (MapListViewController.m:936) | |
7 Philippines 0x000095e7 -[MapListViewController didUpdateToAGoodLocation:] (MapListViewController.m:894) | |
8 Philippines 0x0004fe45 -[RMGPSController locationManager:didUpdateToLocation:fromLocation:] (RMGPSController.m:100) | |
9 CoreLocation 0x307b95df 0x307b1000 + 34271 | |
10 CoreLocation 0x307b8f81 0x307b1000 + 32641 | |
11 CoreLocation 0x307b362f 0x307b1000 + 9775 | |
12 CoreFoundation 0x33fa2b31 0x33f15000 + 580401 | |
13 CoreFoundation 0x33fa215f 0x33f15000 + 577887 | |
14 CoreFoundation 0x33fa1381 0x33f15000 + 574337 | |
15 CoreFoundation 0x33f244dd 0x33f15000 + 62685 | |
16 CoreFoundation 0x33f243a5 0x33f15000 + 62373 | |
17 GraphicsServices 0x307a8fcd 0x307a5000 + 16333 | |
18 UIKit 0x373a5743 0x37374000 + 202563 | |
19 Philippines 0x00002f91 main (main.m:14) | |
20 Philippines 0x00002f50 0x1000 + 8016 | |
Thread 0 name: Dispatch queue: com.apple.main-thread | |
Thread 0 Crashed: | |
0 libsystem_kernel.dylib 0x35ee932c 0x35ed8000 + 70444 | |
1 libsystem_c.dylib 0x32db2f54 0x32d65000 + 319316 | |
2 libsystem_c.dylib 0x32dabfe4 0x32d65000 + 290788 | |
3 libc++abi.dylib 0x333f5f64 abort_message + 40 | |
4 libc++abi.dylib 0x333f3346 default_terminate() + 18 | |
5 libobjc.A.dylib 0x3421e2dc 0x34215000 + 37596 | |
6 libc++abi.dylib 0x333f33be safe_handler_caller(void (*)()) + 70 | |
7 libc++abi.dylib 0x333f344a std::terminate() + 14 | |
8 libc++abi.dylib 0x333f481e __cxa_rethrow + 82 | |
9 libobjc.A.dylib 0x3421e22e 0x34215000 + 37422 | |
10 CoreFoundation 0x33f2453e 0x33f15000 + 62782 | |
11 CoreFoundation 0x33f2439e 0x33f15000 + 62366 | |
12 GraphicsServices 0x307a8fc6 0x307a5000 + 16326 | |
13 UIKit 0x373a573c 0x37374000 + 202556 | |
14 Philippines 0x00002f8a main (main.m:14) | |
15 Philippines 0x00002f48 0x1000 + 8008 | |
Thread 1 name: Dispatch queue: com.apple.libdispatch-manager | |
Thread 1: | |
0 libsystem_kernel.dylib 0x35ed93b4 0x35ed8000 + 5044 | |
1 libdispatch.dylib 0x36c03e78 0x36bf7000 + 52856 | |
2 libdispatch.dylib 0x36c03b96 0x36bf7000 + 52118 | |
Thread 2 name: Dispatch queue: com.apple.locationd.registration.xpcq | |
Thread 2: | |
0 libsystem_kernel.dylib 0x35ed9078 0x35ed8000 + 4216 | |
1 libdispatch.dylib 0x36c040e6 0x36bf7000 + 53478 | |
2 libdispatch.dylib 0x36c04154 0x36bf7000 + 53588 | |
3 CoreLocation 0x307b35a0 0x307b1000 + 9632 | |
4 CoreLocation 0x307b5d2c 0x307b1000 + 19756 | |
5 CoreLocation 0x307e919e 0x307b1000 + 229790 | |
6 CoreLocation 0x307e697e 0x307b1000 + 219518 | |
7 CoreLocation 0x307e778c 0x307b1000 + 223116 | |
8 libxpc.dylib 0x378cf8c2 0x378c7000 + 35010 | |
9 libxpc.dylib 0x378c8d5c 0x378c7000 + 7516 | |
10 libxpc.dylib 0x378c8b18 0x378c7000 + 6936 | |
11 libxpc.dylib 0x378c89b8 0x378c7000 + 6584 | |
12 libxpc.dylib 0x378c83f6 0x378c7000 + 5110 | |
13 libdispatch.dylib 0x36c0521e 0x36bf7000 + 57886 | |
14 libdispatch.dylib 0x36c02b70 0x36bf7000 + 47984 | |
15 libdispatch.dylib 0x36c02caa 0x36bf7000 + 48298 | |
16 libdispatch.dylib 0x36c02b66 0x36bf7000 + 47974 | |
17 libdispatch.dylib 0x36c02caa 0x36bf7000 + 48298 | |
18 libdispatch.dylib 0x36c02b66 0x36bf7000 + 47974 | |
19 libdispatch.dylib 0x36c02caa 0x36bf7000 + 48298 | |
20 libdispatch.dylib 0x36c02b66 0x36bf7000 + 47974 | |
21 libdispatch.dylib 0x36c0376c 0x36bf7000 + 51052 | |
22 libsystem_c.dylib 0x32d6f1c8 0x32d65000 + 41416 | |
23 libsystem_c.dylib 0x32d6f09c 0x32d65000 + 41116 | |
Thread 3 name: WebThread | |
Thread 3: | |
0 libsystem_kernel.dylib 0x35ed9010 0x35ed8000 + 4112 | |
1 libsystem_kernel.dylib 0x35ed9206 0x35ed8000 + 4614 | |
2 CoreFoundation 0x33fa241c 0x33f15000 + 578588 | |
3 CoreFoundation 0x33fa1154 0x33f15000 + 573780 | |
4 CoreFoundation 0x33f244d6 0x33f15000 + 62678 | |
5 CoreFoundation 0x33f2439e 0x33f15000 + 62366 | |
6 WebCore 0x363f8128 0x36350000 + 688424 | |
7 libsystem_c.dylib 0x32d74c16 0x32d65000 + 64534 | |
8 libsystem_c.dylib 0x32d74ad0 0x32d65000 + 64208 | |
Thread 4: | |
0 libsystem_kernel.dylib 0x35ed9010 0x35ed8000 + 4112 | |
1 libsystem_kernel.dylib 0x35ed9206 0x35ed8000 + 4614 | |
2 CoreFoundation 0x33fa241c 0x33f15000 + 578588 | |
3 CoreFoundation 0x33fa1154 0x33f15000 + 573780 | |
4 CoreFoundation 0x33f244d6 0x33f15000 + 62678 | |
5 CoreFoundation 0x33fa1474 0x33f15000 + 574580 | |
6 Philippines 0x00044a8a +[ASIHTTPRequest runRequests] (ASIHTTPRequest.m:4772) | |
7 Foundation 0x35924a8a 0x35914000 + 68234 | |
8 Foundation 0x359b859a 0x35914000 + 673178 | |
9 libsystem_c.dylib 0x32d74c16 0x32d65000 + 64534 | |
10 libsystem_c.dylib 0x32d74ad0 0x32d65000 + 64208 | |
Thread 5 name: com.apple.NSURLConnectionLoader | |
Thread 5: | |
0 libsystem_kernel.dylib 0x35ed9010 0x35ed8000 + 4112 | |
1 libsystem_kernel.dylib 0x35ed9206 0x35ed8000 + 4614 | |
2 CoreFoundation 0x33fa241c 0x33f15000 + 578588 | |
3 CoreFoundation 0x33fa1154 0x33f15000 + 573780 | |
4 CoreFoundation 0x33f244d6 0x33f15000 + 62678 | |
5 CoreFoundation 0x33f2439e 0x33f15000 + 62366 | |
6 Foundation 0x35924bc2 0x35914000 + 68546 | |
7 Foundation 0x35924a8a 0x35914000 + 68234 | |
8 Foundation 0x359b859a 0x35914000 + 673178 | |
9 libsystem_c.dylib 0x32d74c16 0x32d65000 + 64534 | |
10 libsystem_c.dylib 0x32d74ad0 0x32d65000 + 64208 | |
Thread 6: | |
0 libsystem_kernel.dylib 0x35ee9cd4 0x35ed8000 + 72916 | |
1 libsystem_c.dylib 0x32d6f30a 0x32d65000 + 41738 | |
2 libsystem_c.dylib 0x32d6f09c 0x32d65000 + 41116 | |
Thread 7 name: Dispatch queue: com.apple.root.default-priority | |
Thread 7: | |
0 libsystem_c.dylib 0x32d676d8 0x32d65000 + 9944 | |
1 libsystem_c.dylib 0x32d66884 0x32d65000 + 6276 | |
2 ImageIO 0x30de96be png_free + 22 | |
3 libz.1.dylib 0x33cbdccc 0x33cba000 + 15564 | |
4 ImageIO 0x30dea8ac png_read_destroy + 380 | |
5 ImageIO 0x30dea6c6 png_destroy_read_struct + 66 | |
6 ImageIO 0x30deda96 copyImageBlockSetPNG + 2086 | |
7 ImageIO 0x30decea4 ImageProviderCopyImageBlockSetCallback + 412 | |
8 CoreGraphics 0x31b0e7be 0x31b04000 + 42942 | |
9 CoreGraphics 0x31b13e00 0x31b04000 + 65024 | |
10 CoreGraphics 0x31b0e462 0x31b04000 + 42082 | |
11 CoreGraphics 0x31b25622 0x31b04000 + 136738 | |
12 CoreGraphics 0x31b255e4 0x31b04000 + 136676 | |
13 CoreGraphics 0x31b0a510 0x31b04000 + 25872 | |
14 CoreGraphics 0x31b08dca 0x31b04000 + 19914 | |
15 libRIP.A.dylib 0x34319f92 ripc_AcquireImage + 1390 | |
16 libRIP.A.dylib 0x343132b8 ripc_DrawImage + 512 | |
17 CoreGraphics 0x31b08c2a 0x31b04000 + 19498 | |
18 CoreGraphics 0x31b08a96 0x31b04000 + 19094 | |
19 MapKit 0x37b85996 0x37b72000 + 80278 | |
20 MapKit 0x37b854d0 0x37b72000 + 79056 | |
21 QuartzCore 0x34ac3e16 0x34ab8000 + 48662 | |
22 QuartzCore 0x34b7f7de 0x34ab8000 + 817118 | |
23 QuartzCore 0x34b12f22 0x34ab8000 + 372514 | |
24 libdispatch.dylib 0x36c0379c 0x36bf7000 + 51100 | |
25 libsystem_c.dylib 0x32d6f1c8 0x32d65000 + 41416 | |
26 libsystem_c.dylib 0x32d6f09c 0x32d65000 + 41116 | |
Thread 8 name: com.apple.CFSocket.private | |
Thread 8: | |
0 libsystem_kernel.dylib 0x35ee9570 0x35ed8000 + 71024 | |
1 CoreFoundation 0x33fa666a 0x33f15000 + 595562 | |
2 libsystem_c.dylib 0x32d74c16 0x32d65000 + 64534 | |
3 libsystem_c.dylib 0x32d74ad0 0x32d65000 + 64208 | |
Thread 9: | |
0 libsystem_kernel.dylib 0x35ee9cd4 0x35ed8000 + 72916 | |
1 libsystem_c.dylib 0x32d6f30a 0x32d65000 + 41738 | |
2 libsystem_c.dylib 0x32d6f09c 0x32d65000 + 41116 | |
Thread 0 crashed with ARM Thread State: | |
r0: 0x00000000 r1: 0x00000000 r2: 0x00000001 r3: 0x00000000 | |
r4: 0x00000006 r5: 0x3e69cce8 r6: 0x00000002 r7: 0x2fdffa58 | |
r8: 0x4043b783 r9: 0x333f6a4a r10: 0x3fa042e8 r11: 0x17bc9856 | |
ip: 0x00000148 sp: 0x2fdffa4c lr: 0x32db2f5b pc: 0x35ee932c | |
cpsr: 0x00000010 | |
Binary Images: | |
0x1000 - 0x87fff +Philippines armv7 <f9d1adfc06ad3d8f94fde2a8edc11e3c> /var/mobile/Applications/AD401050-1A1F-404C-ADF6-A3600ABEF16B/Philippines.app/Philippines | |
0x2fe6e000 - 0x2fe8ffff dyld armv7 <be7c0b491a943054ad12eb5060f1da06> /usr/lib/dyld | |
0x3027d000 - 0x3053efff libLAPACK.dylib armv7 <5490a87fe5153771b9c67940292842ba> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libLAPACK.dylib | |
0x3053f000 - 0x3057cfff IOKit armv7 <e5f727892ee034a4be04e6da608f413f> /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit | |
0x30585000 - 0x30594fff SpringBoardServices armv7 <79f1564c1b23303eb3b7db67f9375228> /System/Library/PrivateFrameworks/SpringBoardServices.framework/SpringBoardServices | |
0x3065e000 - 0x306a7fff ManagedConfiguration armv7 <05711081dd883c58a844c5f9c251e8c9> /System/Library/PrivateFrameworks/ManagedConfiguration.framework/ManagedConfiguration | |
0x30703000 - 0x30707fff FTClientServices armv7 <8f823e791c9e37b4b47323bb0286e86c> /System/Library/PrivateFrameworks/FTClientServices.framework/FTClientServices | |
0x30708000 - 0x30759fff CoreText armv7 <23150093d39b393e9bc5f8230176df47> /System/Library/Frameworks/CoreText.framework/CoreText | |
0x3075d000 - 0x30764fff ProtocolBuffer armv7 <6ca7dca9370132a2a592356bf9f2170b> /System/Library/PrivateFrameworks/ProtocolBuffer.framework/ProtocolBuffer | |
0x307a5000 - 0x307b0fff GraphicsServices armv7 <4ec745ffb2e039faab4b39a30268f707> /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices | |
0x307b1000 - 0x307fcfff CoreLocation armv7 <e959d4dd596b31eeaa49c8c0156b1e12> /System/Library/Frameworks/CoreLocation.framework/CoreLocation | |
0x307ff000 - 0x30805fff libnotify.dylib armv7 <1e374857ac68370095ddbafe94f021a1> /usr/lib/system/libnotify.dylib | |
0x30806000 - 0x3086afff MessageUI armv7 <c9d526c181ed3625b32327044d78dad3> /System/Library/Frameworks/MessageUI.framework/MessageUI | |
0x308ca000 - 0x308cffff libcopyfile.dylib armv7 <9072462f28af3665875b3ecaba002c00> /usr/lib/system/libcopyfile.dylib | |
0x30bcb000 - 0x30c07fff IMFoundation armv7 <d93ec1a0f854355da1e4f8aca176e749> /System/Library/PrivateFrameworks/IMCore.framework/Frameworks/IMFoundation.framework/IMFoundation | |
0x30c08000 - 0x30c3dfff SystemConfiguration armv7 <753be0ebdcb13b24b1a4adcdc94d6bd9> /System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration | |
0x30c3e000 - 0x30d18fff vImage armv7 <42a5e58ff1b9350cad90de36bd3ceb09> /System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/vImage | |
0x30d75000 - 0x30dccfff CoreAudio armv7 <2e4975a2156e328585f2a478e80704fc> /System/Library/Frameworks/CoreAudio.framework/CoreAudio | |
0x30de5000 - 0x30fa1fff ImageIO armv7 <df300f66a317352e92354a8a48af3453> /System/Library/Frameworks/ImageIO.framework/ImageIO | |
0x31027000 - 0x31047fff libxslt.1.dylib armv7 <f37418b7e89137bba433677d61cd779d> /usr/lib/libxslt.1.dylib | |
0x3108a000 - 0x310a9fff libSystem.B.dylib armv7 <31a0ffbb18bf3a28b46fd286733e7d9f> /usr/lib/libSystem.B.dylib | |
0x310b1000 - 0x310f4fff libcommonCrypto.dylib armv7 <be9a231cfe6e3ae387abb444a098bce9> /usr/lib/system/libcommonCrypto.dylib | |
0x310f5000 - 0x3113ffff CoreTelephony armv7 <1f4cacb552533c948122cb180f4192b3> /System/Library/Frameworks/CoreTelephony.framework/CoreTelephony | |
0x3150e000 - 0x31657fff libicucore.A.dylib armv7 <1bc960f75d633190a09b093209a9f0c5> /usr/lib/libicucore.A.dylib | |
0x3165a000 - 0x3165efff IOMobileFramebuffer armv7 <c2e6bd6dafde3097b47bc255a8c871ef> /System/Library/PrivateFrameworks/IOMobileFramebuffer.framework/IOMobileFramebuffer | |
0x316b6000 - 0x316f3fff FTServices armv7 <fc9e7d223d3f33898603cfba115f5094> /System/Library/PrivateFrameworks/FTServices.framework/FTServices | |
0x31732000 - 0x31738fff liblaunch.dylib armv7 <09f21c3e774c30b1aab1b56c2d6efbc3> /usr/lib/system/liblaunch.dylib | |
0x31751000 - 0x31788fff Security armv7 <b89c9f6373f037f2a4801558f97b9a95> /System/Library/Frameworks/Security.framework/Security | |
0x317d5000 - 0x3186dfff EventKit armv7 <f340aafa660d308a8cd86fd180aeaad9> /System/Library/Frameworks/EventKit.framework/EventKit | |
0x318a2000 - 0x319fffff libmecabra.dylib armv7 <170c82a3c716372abe7ae0aae96d4805> /usr/lib/libmecabra.dylib | |
0x31afd000 - 0x31b03fff liblockdown.dylib armv7 <bfaf7fb16e5a3b2ea07c47b8b2f2b64e> /usr/lib/liblockdown.dylib | |
0x31b04000 - 0x31c49fff CoreGraphics armv7 <641fb6e558f239588a8bd05dbefff99a> /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics | |
0x31ecd000 - 0x31f16fff CoreMedia armv7 <d585cf4e0cfa34fa8beaa43b06a4bcd7> /System/Library/Frameworks/CoreMedia.framework/CoreMedia | |
0x31f17000 - 0x31f1afff ActorKit armv7 <8c167170891238b3940f9f54105b6eb9> /System/Library/PrivateFrameworks/ActorKit.framework/ActorKit | |
0x31fd1000 - 0x320a8fff CFNetwork armv7 <6fbc9f187eaa30009780e70288c9f289> /System/Library/Frameworks/CFNetwork.framework/CFNetwork | |
0x320a9000 - 0x320bafff DataAccessExpress armv7 <6bc443b0f87e338698cac9e5a96e8f8f> /System/Library/PrivateFrameworks/DataAccessExpress.framework/DataAccessExpress | |
0x32669000 - 0x3266cfff CoreTime armv7 <e2f02260f2a63359b9a0a47c69f59c9e> /System/Library/PrivateFrameworks/CoreTime.framework/CoreTime | |
0x3284e000 - 0x328f4fff AddressBookUI armv7 <d785fe33cd263f5aba861ad919c66924> /System/Library/Frameworks/AddressBookUI.framework/AddressBookUI | |
0x328f8000 - 0x32921fff AppleAccount armv7 <b0baa956f6a8308a8d9faac126ef6f95> /System/Library/PrivateFrameworks/AppleAccount.framework/AppleAccount | |
0x32940000 - 0x32948fff MobileWiFi armv7 <f07cb8d6dadf36919bae8ef6e5ce1749> /System/Library/PrivateFrameworks/MobileWiFi.framework/MobileWiFi | |
0x32ab5000 - 0x32c4dfff CoreData armv7 <dd6d139d99e5309f9df33f7b6a044b16> /System/Library/Frameworks/CoreData.framework/CoreData | |
0x32ccb000 - 0x32ccffff libcache.dylib armv7 <4511f0ec5b713636aaade7245a12553c> /usr/lib/system/libcache.dylib | |
0x32d65000 - 0x32df2fff libsystem_c.dylib armv7 <1707c3cf3c5b3045af4bed38ff8420a6> /usr/lib/system/libsystem_c.dylib | |
0x32df6000 - 0x32dfafff AggregateDictionary armv7 <cfd957904957310381369729bfd9b2b0> /System/Library/PrivateFrameworks/AggregateDictionary.framework/AggregateDictionary | |
0x3304a000 - 0x33059fff MobileDeviceLink armv7 <09c637a85e3d3af488e59ced95a5a916> /System/Library/PrivateFrameworks/MobileDeviceLink.framework/MobileDeviceLink | |
0x33128000 - 0x3312cfff libGFXShared.dylib armv7 <0a36fb9d60a43479943bafb2f81313b1> /System/Library/Frameworks/OpenGLES.framework/libGFXShared.dylib | |
0x331d2000 - 0x33217fff GeoServices armv7 <6c9eb6372f723a57852cfc9ed7b78e31> /System/Library/PrivateFrameworks/GeoServices.framework/GeoServices | |
0x33218000 - 0x33273fff StoreServices armv7 <1463a9f90fbd3d349544cf016e1ddd46> /System/Library/PrivateFrameworks/StoreServices.framework/StoreServices | |
0x33274000 - 0x33275fff DataMigration armv7 <d067b65a904a3f438b5d9e13b208b117> /System/Library/PrivateFrameworks/DataMigration.framework/DataMigration | |
0x3329c000 - 0x333c0fff JavaScriptCore armv7 <24ff2747b3973aecb9c37960eba5ff4d> /System/Library/PrivateFrameworks/JavaScriptCore.framework/JavaScriptCore | |
0x333c4000 - 0x333c9fff CrashReporterSupport armv7 <c3062554536438f9874c88363df7f60b> /System/Library/PrivateFrameworks/CrashReporterSupport.framework/CrashReporterSupport | |
0x333cc000 - 0x333cdfff libdnsinfo.dylib armv7 <dbd1e77a4beb309d8f160d927d442467> /usr/lib/system/libdnsinfo.dylib | |
0x333e4000 - 0x333e5fff libsystem_blocks.dylib armv7 <4bb9797771d037879bec814fe750d86d> /usr/lib/system/libsystem_blocks.dylib | |
0x333e6000 - 0x333edfff AssetsLibraryServices armv7 <c0093954f6ee329aa6b4848215bcb8c0> /System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices | |
0x333ee000 - 0x333eefff vecLib armv7 <106ef8294b0d3c2d89e9230527846227> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/vecLib | |
0x333ef000 - 0x333f6fff libc++abi.dylib armv7 <f769ce305c3033ee90e8c2ecc4846619> /usr/lib/libc++abi.dylib | |
0x33424000 - 0x33447fff MobileSync armv7 <be06df250fff368b92bc0a1defc6df9c> /System/Library/PrivateFrameworks/MobileSync.framework/MobileSync | |
0x3345b000 - 0x3345ffff libAccessibility.dylib armv7 <ee734c0e964934a887a66d170270b114> /usr/lib/libAccessibility.dylib | |
0x33460000 - 0x334d0fff CoreImage armv7 <b1d0678497f43769840f173c0f9dce20> /System/Library/Frameworks/CoreImage.framework/CoreImage | |
0x3360e000 - 0x33671fff IMCore armv7 <c235020b86123e95820f7323916023aa> /System/Library/PrivateFrameworks/IMCore.framework/IMCore | |
0x33672000 - 0x33673fff libdyld.dylib armv7 <f1963e7ef64e39a58ec1e39ed7c74849> /usr/lib/system/libdyld.dylib | |
0x33681000 - 0x33684fff libcompiler_rt.dylib armv7 <414332f9a55238bab2cbec323e0fc8da> /usr/lib/system/libcompiler_rt.dylib | |
0x33685000 - 0x336dbfff GMM armv7 <5b18530ef2ab39fcb5f28da01beec3d1> /System/Library/PrivateFrameworks/GMM.framework/GMM | |
0x336dc000 - 0x3370ffff MIME armv7 <0c29ae0826c53ebbaf9424b389016b68> /System/Library/PrivateFrameworks/MIME.framework/MIME | |
0x33832000 - 0x3383cfff libvMisc.dylib armv7 <b93ee3136d1c3d44b1e513a56bb0f86c> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libvMisc.dylib | |
0x339d0000 - 0x339d1fff libremovefile.dylib armv7 <9c8cee9652453241ac1fc99eab05c40a> /usr/lib/system/libremovefile.dylib | |
0x339de000 - 0x33a8afff MediaControlSender armv7 <4c0982b21ecf35aead8e0bef55d842b0> /System/Library/PrivateFrameworks/MediaControlSender.framework/MediaControlSender | |
0x33bb2000 - 0x33c60fff Message armv7 <0d844e0108b1301bb08a74df3e3589b5> /System/Library/PrivateFrameworks/Message.framework/Message | |
0x33c61000 - 0x33c65fff Marco armv7 <526949ce76323de09ee69812383c2953> /System/Library/PrivateFrameworks/Marco.framework/Marco | |
0x33cba000 - 0x33cc6fff libz.1.dylib armv7 <eef915ed9b2c3433b03fd9030957b945> /usr/lib/libz.1.dylib | |
0x33ccf000 - 0x33cf2fff Bom armv7 <0e6087f75a81345ea81751197ccb712c> /System/Library/PrivateFrameworks/Bom.framework/Bom | |
0x33d2a000 - 0x33d7bfff libstdc++.6.dylib armv7 <dc2061145c1a3307829d4f3bfc547c1a> /usr/lib/libstdc++.6.dylib | |
0x33da8000 - 0x33dcdfff OpenCL armv7 <e1d5bfcdb59934b0923b9307c75e7457> /System/Library/PrivateFrameworks/OpenCL.framework/OpenCL | |
0x33dd9000 - 0x33deffff DictionaryServices armv7 <5bbab664f97932a79a1566fda3a4383e> /System/Library/PrivateFrameworks/DictionaryServices.framework/DictionaryServices | |
0x33dfd000 - 0x33e09fff libCRFSuite.dylib armv7 <ea460e3f1ac338a9885d5752864dbffb> /usr/lib/libCRFSuite.dylib | |
0x33ef2000 - 0x33ef7fff ApplePushService armv7 <2e620a6e8ee8387ba2771cfd7870c90e> /System/Library/PrivateFrameworks/ApplePushService.framework/ApplePushService | |
0x33ef8000 - 0x33efbfff libsystem_network.dylib armv7 <b18e0a845b1e317c8abcf6b5d06b29a0> /usr/lib/system/libsystem_network.dylib | |
0x33f15000 - 0x3402cfff CoreFoundation armv7 <de9eefc6109735369cfd8f3de9895da0> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation | |
0x34034000 - 0x34078fff MobileCoreServices armv7 <9a79a2d389ba35389a30782ed01c46dd> /System/Library/Frameworks/MobileCoreServices.framework/MobileCoreServices | |
0x34079000 - 0x34086fff libbsm.0.dylib armv7 <a6414b0a5fd53df58c4f0b2f8878f81f> /usr/lib/libbsm.0.dylib | |
0x340aa000 - 0x340aafff libCVMSPluginSupport.dylib armv7 <85582e1094633fccb52b50ca13c5a5d0> /System/Library/Frameworks/OpenGLES.framework/libCVMSPluginSupport.dylib | |
0x340c2000 - 0x340d7fff libresolv.9.dylib armv7 <97d6ebbb53ae3e0480f51771c9665613> /usr/lib/libresolv.9.dylib | |
0x34215000 - 0x342dbfff libobjc.A.dylib armv7 <ebbb32df194b331e9b3dc14e40f46833> /usr/lib/libobjc.A.dylib | |
0x34306000 - 0x3430bfff libsystem_dnssd.dylib armv7 <4d8b38f1cb603f0d8af78c56c485f05a> /usr/lib/system/libsystem_dnssd.dylib | |
0x3430c000 - 0x3430dfff libsystem_sandbox.dylib armv7 <b8612b4ce18535aaa94f4b75c730e090> /usr/lib/system/libsystem_sandbox.dylib | |
0x3430e000 - 0x34327fff libRIP.A.dylib armv7 <ad22ea5ee99a358691f9820e62c85058> /System/Library/Frameworks/CoreGraphics.framework/Resources/libRIP.A.dylib | |
0x343cc000 - 0x343e2fff libmis.dylib armv7 <fd046316dedc34dd81a6601ea3b1e8a6> /usr/lib/libmis.dylib | |
0x343e3000 - 0x34406fff PrintKit armv7 <279fb51deec3377ab9f820af2da4d915> /System/Library/PrivateFrameworks/PrintKit.framework/PrintKit | |
0x34532000 - 0x34a76fff FaceCoreLight armv7 <cc2edb3645d2390dbca5471d35f1bf6e> /System/Library/PrivateFrameworks/FaceCoreLight.framework/FaceCoreLight | |
0x34a77000 - 0x34a79fff libCoreVMClient.dylib armv7 <6ddb7cf8a93830628787a5b83eea0f1d> /System/Library/Frameworks/OpenGLES.framework/libCoreVMClient.dylib | |
0x34ab8000 - 0x34ba8fff QuartzCore armv7 <ff595b1a042933249466e92433e1af6f> /System/Library/Frameworks/QuartzCore.framework/QuartzCore | |
0x34ba9000 - 0x34baafff CoreSurface armv7 <fcb6a869daef3a3abc4300c28b218e9f> /System/Library/PrivateFrameworks/CoreSurface.framework/CoreSurface | |
0x34bab000 - 0x34c24fff ProofReader armv7 <09d057676f6837cd9e7a735444b67e77> /System/Library/PrivateFrameworks/ProofReader.framework/ProofReader | |
0x34c5f000 - 0x34d2ffff WebKit armv7 <74661b1bf4613aafb827bfe0134ed92b> /System/Library/PrivateFrameworks/WebKit.framework/WebKit | |
0x34d30000 - 0x34f8afff MediaToolbox armv7 <ab91ec33f2b23606bd0443163beff710> /System/Library/PrivateFrameworks/MediaToolbox.framework/MediaToolbox | |
0x34ffd000 - 0x35001fff CertUI armv7 <9d24f62513913888b2ac55f1db27b908> /System/Library/PrivateFrameworks/CertUI.framework/CertUI | |
0x350ee000 - 0x350f5fff MailServices armv7 <a5e048e513b237b78d62fb3996a85fa9> /System/Library/PrivateFrameworks/MailServices.framework/MailServices | |
0x3513d000 - 0x3531afff AudioToolbox armv7 <da4f78fd20fb3b42b1a8be4f383d9c12> /System/Library/Frameworks/AudioToolbox.framework/AudioToolbox | |
0x35339000 - 0x35382fff libc++.1.dylib armv7 <ad15503487243836b7c296f3439ba0c1> /usr/lib/libc++.1.dylib | |
0x3538e000 - 0x3546dfff RawCamera armv7 <4fb932b6a2d83c4eadfcecf53220699a> /System/Library/CoreServices/RawCamera.bundle/RawCamera | |
0x35493000 - 0x35804fff TextInput armv7 <64d1227219b03c51ba4854ec2f79c335> /System/Library/PrivateFrameworks/TextInput.framework/TextInput | |
0x358bb000 - 0x358d1fff EAP8021X armv7 <16801802d86e3c479f3034034192faed> /System/Library/PrivateFrameworks/EAP8021X.framework/EAP8021X | |
0x358d2000 - 0x358ddfff AccountSettings armv7 <090bb6a4f97433089b5cabc6a40c619a> /System/Library/PrivateFrameworks/AccountSettings.framework/AccountSettings | |
0x358de000 - 0x35913fff DataAccess armv7 <432578d415dd3398b3487f003b3100ac> /System/Library/PrivateFrameworks/DataAccess.framework/DataAccess | |
0x35914000 - 0x35a92fff Foundation armv7 <ce466f428d953caaac6641d186665809> /System/Library/Frameworks/Foundation.framework/Foundation | |
0x35a9c000 - 0x35ae6fff libvDSP.dylib armv7 <d8489a4ce77933abac52394c43ff5513> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libvDSP.dylib | |
0x35ba3000 - 0x35ba9fff MobileKeyBag armv7 <f5633749a1c83058a28cd7d0b488e19f> /System/Library/PrivateFrameworks/MobileKeyBag.framework/MobileKeyBag | |
0x35be0000 - 0x35beffff GenerationalStorage armv7 <c581bffc87013530b3c2d017142395e6> /System/Library/PrivateFrameworks/GenerationalStorage.framework/GenerationalStorage | |
0x35bf0000 - 0x35c29fff VideoToolbox armv7 <49f9f09f23f7396b94a29bb1280759fe> /System/Library/PrivateFrameworks/VideoToolbox.framework/VideoToolbox | |
0x35c31000 - 0x35c34fff CaptiveNetwork armv7 <c3a5b1659eb0302eb205498ffacb09f1> /System/Library/PrivateFrameworks/CaptiveNetwork.framework/CaptiveNetwork | |
0x35c3a000 - 0x35c3afff Accelerate armv7 <a62771c826753815a5cae96eaa60ffd7> /System/Library/Frameworks/Accelerate.framework/Accelerate | |
0x35c6b000 - 0x35c88fff libsystem_info.dylib armv7 <1e36ab94661c372bab5a801d68c79353> /usr/lib/system/libsystem_info.dylib | |
0x35c91000 - 0x35c91fff libgcc_s.1.dylib armv7 <69d8dab7388b33d38b30708fd6b6a340> /usr/lib/libgcc_s.1.dylib | |
0x35df0000 - 0x35e2ffff QuickLook armv7 <fdc0e38e19f9316fb0923c390e8d3ccd> /System/Library/Frameworks/QuickLook.framework/QuickLook | |
0x35ed8000 - 0x35eeefff libsystem_kernel.dylib armv7 <afd3cb06e20336dca2e5a6e11d080504> /usr/lib/system/libsystem_kernel.dylib | |
0x35eef000 - 0x35efbfff CoreVideo armv7 <474c89eb09fe3464851a20d76052341b> /System/Library/Frameworks/CoreVideo.framework/CoreVideo | |
0x35efc000 - 0x35f7ffff CoreMotion armv7 <f4365ff3974b3049b3f04b3f55a46ae6> /System/Library/Frameworks/CoreMotion.framework/CoreMotion | |
0x35fe2000 - 0x35fe4fff MobileInstallation armv7 <4ccf76f0e6cb3cd7b4e0087c2f284a1d> /System/Library/PrivateFrameworks/MobileInstallation.framework/MobileInstallation | |
0x36036000 - 0x36062fff libtidy.A.dylib armv7 <f0eca72c10c537fa89b17fd97e003faf> /usr/lib/libtidy.A.dylib | |
0x36164000 - 0x361a4fff libGLImage.dylib armv7 <9440420d838a382caa175399d74a5044> /System/Library/Frameworks/OpenGLES.framework/libGLImage.dylib | |
0x361a5000 - 0x3624ffff libBLAS.dylib armv7 <9aabff01422f3cb8960f93d11d2b6de1> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libBLAS.dylib | |
0x36250000 - 0x3633efff libiconv.2.dylib armv7 <6e858938edb93162ba8cf25702f08b16> /usr/lib/libiconv.2.dylib | |
0x36350000 - 0x36b07fff WebCore armv7 <7137e0ea008f3a3e8ae9e57f96d34d1d> /System/Library/PrivateFrameworks/WebCore.framework/WebCore | |
0x36b08000 - 0x36b38fff ContentIndex armv7 <e610e7e8c8653d728dcc3c8fb471a994> /System/Library/PrivateFrameworks/ContentIndex.framework/ContentIndex | |
0x36bad000 - 0x36badfff libkeymgr.dylib armv7 <791bb8b832943b2392c0c35228f52e09> /usr/lib/system/libkeymgr.dylib | |
0x36bc8000 - 0x36bdcfff PersistentConnection armv7 <81eb1b3e08cf3d7196313307ad60649d> /System/Library/PrivateFrameworks/PersistentConnection.framework/PersistentConnection | |
0x36bf7000 - 0x36c0dfff libdispatch.dylib armv7 <defe319d1f4d3c1c8c4f18ebd96b396a> /usr/lib/system/libdispatch.dylib | |
0x36db6000 - 0x36dcdfff WebBookmarks armv7 <ca6cb19e568738a0a6e30b616ee33ab0> /System/Library/PrivateFrameworks/WebBookmarks.framework/WebBookmarks | |
0x36e24000 - 0x36e5ffff libCGFreetype.A.dylib armv7 <753daf497ca736739a30126661a522f1> /System/Library/Frameworks/CoreGraphics.framework/Resources/libCGFreetype.A.dylib | |
0x36e80000 - 0x36e80fff liblangid.dylib armv7 <342170169bf232a0888912f5ef97112d> /usr/lib/liblangid.dylib | |
0x36e81000 - 0x36ecafff AddressBook armv7 <0a858565acd03f28a1bc69a650b64a7b> /System/Library/Frameworks/AddressBook.framework/AddressBook | |
0x36ee5000 - 0x36ee9fff IOSurface armv7 <0f003f50b18e3dbf87607d819e0ac6b9> /System/Library/PrivateFrameworks/IOSurface.framework/IOSurface | |
0x3719d000 - 0x371b0fff Notes armv7 <b2cb7346cb2b36eca53d22534c53b508> /System/Library/PrivateFrameworks/Notes.framework/Notes | |
0x371b1000 - 0x371bbfff libbz2.1.0.dylib armv7 <28583efb9f1b38e7ae83c667b07dbd08> /usr/lib/libbz2.1.0.dylib | |
0x371f6000 - 0x371fcfff MobileIcons armv7 <2f4c13053206306996726629b0b7eb01> /System/Library/PrivateFrameworks/MobileIcons.framework/MobileIcons | |
0x372bc000 - 0x372c5fff libMobileGestalt.dylib armv7 <bf8d7c30f11a393a8adf4c8277e65aa3> /usr/lib/libMobileGestalt.dylib | |
0x372c6000 - 0x37373fff libxml2.2.dylib armv7 <78462273eb5b38d1a0873b02f0e35e23> /usr/lib/libxml2.2.dylib | |
0x37374000 - 0x3780dfff UIKit armv7 <97b527cd6fba35c6bb39263e0f362223> /System/Library/Frameworks/UIKit.framework/UIKit | |
0x37813000 - 0x37892fff libsqlite3.dylib armv7 <af4718fee01734748c42f2214ab6883d> /usr/lib/libsqlite3.dylib | |
0x378b7000 - 0x378c6fff OpenGLES armv7 <6d1afb451f50310895ec59864739e781> /System/Library/Frameworks/OpenGLES.framework/OpenGLES | |
0x378c7000 - 0x378d8fff libxpc.dylib armv7 <7d49e385ee5d3e7eb08d06525abd6435> /usr/lib/system/libxpc.dylib | |
0x378e1000 - 0x378e4fff libmacho.dylib armv7 <3237bc9c109e3354bc4b38b957243f31> /usr/lib/system/libmacho.dylib | |
0x378e5000 - 0x37921fff AppSupport armv7 <de0c2fbb95f8383db43acfb44e9c66fe> /System/Library/PrivateFrameworks/AppSupport.framework/AppSupport | |
0x3795e000 - 0x3795efff libunwind.dylib armv7 <d21222aad8c93d6c9580f9bf47071946> /usr/lib/system/libunwind.dylib | |
0x37973000 - 0x37a3cfff Celestial armv7 <c18e76311fc33016be930da83050b96d> /System/Library/PrivateFrameworks/Celestial.framework/Celestial | |
0x37b72000 - 0x37bf4fff MapKit armv7 <1dd7d48dbbb6395ca77b97c2db4ae36e> /System/Library/Frameworks/MapKit.framework/MapKit | |
0x37bf7000 - 0x37c33fff iCalendar armv7 <59d80290d8733df8a6310da65b497fc9> /System/Library/PrivateFrameworks/iCalendar.framework/iCalendar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "HJImageView.h" | |
#import "JSONKit.h" | |
#import "ASIHTTPRequest.h" | |
#import "Country.h" | |
#import "ApplicationConstants.h" | |
#import "MainTableViewConstants.h" | |
#import "HelperFileUtils.h" | |
#import "HelperText.h" | |
#import "HelperDevice.h" | |
#import "HelperLogUtils.h" | |
#import "MapListViewController.h" | |
#import "ApplicationCell.h" | |
#import "PoiImageTableViewApplicationCell.h" | |
#import "MapSettingsViewController.h" | |
#import "SearchViewController.h" | |
#import "DetailsViewController.h" | |
#import "ImageCache.h" | |
#import "NSString+Utilities.h" | |
#import "UBAlertView.h" | |
#import "HelperAlert.h" | |
#ifdef __APPLE__ | |
#include "TargetConditionals.h" | |
#endif | |
@interface MapListViewController(private) | |
- (void)initMapRegion; | |
- (void)initMBR; | |
- (void)dismissPopoverViewController; | |
- (void)createProgressionAlertWithMessage:(NSString *)message; | |
- (void)createGPSNotification; | |
- (void)hideGPSAlert; | |
- (void)startGPS; | |
- (void)stopGPS; | |
- (void)timeOutGPS; | |
- (void)showGPSAlert:(NSString*)alertTitle message:(NSString*)_message; | |
- (BOOL)checkLocationIfWithinBounds:(CLLocationCoordinate2D)_coordinate; | |
- (void)addUserAnnotation:(CLLocationCoordinate2D)_coordinate; | |
- (void)initiateRecentSearchHTTPRequest:(NSString*)_poiType; | |
- (void)initiateNearbySearchHTTPRequest; | |
- (void)initiateKeywordSearchHTTPRequest:(NSString*)_keyword; | |
- (void)startHTTPRequest:(NSString *)urlDirty; | |
- (void)toggleButtonMoreResults; | |
- (void)createDataModel:(NSMutableArray*)_poiArray; | |
- (void)appendDataModel:(NSMutableArray*)_poiArray; | |
- (void)addPoiAnnotations:(NSMutableArray*)_poiArray; | |
- (void)addPoiAnnotations:(NSMutableArray*)_poiArray startIndex:(int)_lastCount; | |
- (void)zoomToFitPoiAnnotations; | |
- (void)startAnimating; | |
- (void)startAnimating:(NSString*)_message; | |
- (void)stopAnimating; | |
- (void)showDetailsViewController:(PoiAnnotation*)_annotation; | |
- (void)showDetailsViewController:(PoiAnnotation*)_annotation withCellFrame:(CGRect)frame; | |
- (void)disableToolBarItems; | |
- (void)enableToolBarState; | |
@end | |
@implementation MapListViewController | |
@synthesize mapview, tableviewContent, segmentedControl; | |
@synthesize barButtonHome, barButtonSearch, barButtonMoreResults, barButtonPageCurl, spinner, toolbar; | |
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil | |
{ | |
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; | |
if (self) | |
{ | |
boolMenuVisible = NO; | |
[RMGPSController sharedInstance].delegate = self; | |
[RMGPSController sharedInstance].locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters; | |
[RMGPSController sharedInstance].locationManager.distanceFilter = 100; | |
userAnnotation = nil; | |
arrayPoiAnnotations = [[NSMutableArray alloc] initWithObjects:nil]; | |
lastPage = 1; | |
lastKnownPage = 1; | |
totalPages = 0; | |
lastKnownTotalPages = 0; | |
boolPendingRequestForNearbySearchHTTPRequest = NO; | |
boolPendingRequestForRecentWithKeywordSearchHTTPRequest = NO; | |
poiType = [[NSMutableString alloc] init]; | |
lastURLString = [[NSMutableString alloc] init]; | |
lastKnownURLString = [[NSMutableString alloc] init]; | |
lastKeyword = [[NSMutableString alloc] init]; | |
lastKnownIndexSelected = 0; | |
popoverController = nil; | |
gpsNotificationAlertView = nil; | |
boolGPSTimeoutActive = NO; | |
boolGPSAlertShown = NO; | |
boolShowCurrentLocation = NO; | |
mapPlist_ = nil; | |
[self initMBR]; | |
} | |
return self; | |
} | |
- (void)initMapPList | |
{ | |
if(mapPlist_ == nil) | |
mapPlist_ = [[NSDictionary alloc] initWithContentsOfFile:[HelperFileUtils fileInBundle:@"Map.plist"]]; | |
} | |
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. | |
- (void)viewDidLoad | |
{ | |
DLog(@"begin"); | |
[super viewDidLoad]; | |
if ( ! [[RMGPSController sharedInstance] isLocationServicesEnabled]) | |
DLog(@"NoLocationServices", @"User disabled location services"); | |
//Get the settings from the Map.plist | |
[self initMapPList]; | |
//Create a GPS Alert but don't show it yet | |
[self createGPSNotification]; | |
//When the view is loaded there are no results yet os buttonMoreResults is disabled. | |
barButtonMoreResults.enabled = NO; | |
stateBoolMoreResults = barButtonMoreResults.isEnabled; | |
[self initMapRegion]; | |
//this will set the default view to a map. Used only in the iPhone | |
segmentedControl.selectedSegmentIndex = 0; | |
//in case we came from a memory warning and it loads again | |
if([arrayPoiAnnotations count] > 0) | |
{ | |
DLog(@"arrayPoiAnnotations count:%d", [arrayPoiAnnotations count]); | |
[mapview addAnnotations:arrayPoiAnnotations]; | |
[self zoomToFitPoiAnnotations]; | |
} | |
[segmentedControl setImage:[UIImage imageNamed:@"button_map_selected.png"] forSegmentAtIndex:0]; | |
[segmentedControl setImage:[UIImage imageNamed:@"button_list.png"] forSegmentAtIndex:1]; | |
DLog(@"end"); | |
} | |
- (void)viewDidUnload | |
{ | |
[super viewDidUnload]; | |
// Release any retained subviews of the main view. | |
// e.g. self.myOutlet = nil; | |
[gpsNotificationAlertView release], gpsNotificationAlertView = nil; | |
[mapPlist_ release], mapPlist_ = nil; | |
} | |
- (void)viewWillAppear:(BOOL)animated | |
{ | |
DLog(@"begin"); | |
[self.navigationController setNavigationBarHidden:YES animated:YES]; | |
[super viewWillAppear:animated]; | |
} | |
- (void)dealloc | |
{ | |
DLog(@"dealloc"); | |
[lastURLString release]; | |
[lastKnownURLString release]; | |
[poiType release]; | |
[lastKeyword release]; | |
[mapview release]; | |
[tableviewContent release]; | |
[userAnnotation release]; | |
[arrayPoiAnnotations release]; | |
[segmentedControl release]; | |
[barButtonHome release]; | |
[barButtonSearch release]; | |
[barButtonMoreResults release]; | |
[barButtonPageCurl release]; | |
[toolbar release]; | |
[gpsNotificationAlertView release]; | |
if(popoverController != nil) | |
[popoverController release]; | |
[super dealloc]; | |
} | |
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation | |
{ | |
return [HelperDevice shouldAutorotateToInterfaceOrientation:interfaceOrientation]; | |
} | |
- (void)didReceiveMemoryWarning | |
{ | |
DLog(@"begin"); | |
// Releases the view if it doesn't have a superview. | |
[super didReceiveMemoryWarning]; | |
} | |
#pragma mark public methods | |
- (void)setSearchModel:(SearchItemsModel*)_model | |
{ | |
modelSearch = _model; | |
} | |
- (void)nearby | |
{ | |
boolPendingRequestForNearbySearchHTTPRequest = YES; | |
[self startGPS]; | |
} | |
- (void)recent:(NSString*)_poiType | |
{ | |
boolPendingRequestForRecentWithKeywordSearchHTTPRequest = YES; | |
[poiType setString:_poiType]; | |
[self startGPS]; | |
//[self initiateRecentSearchHTTPRequest:_poiType]; | |
} | |
- (void)recentAll | |
{ | |
[self initiateRecentSearchHTTPRequest:nil]; | |
} | |
#pragma mark private methods | |
- (void)createProgressionAlertWithMessage:(NSString *)message | |
{ | |
if(progressAlert == nil) | |
{ | |
progressAlert = [[UIAlertView alloc] initWithTitle: @"" message: message | |
delegate: self | |
cancelButtonTitle: nil | |
otherButtonTitles: nil]; | |
UIActivityIndicatorView *activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite]; | |
activityView.frame = CGRectMake(139.0f-18.0f, 55.0f, 37.0f, 37.0f); | |
[progressAlert addSubview:activityView]; | |
[activityView startAnimating]; | |
[activityView release]; | |
[progressAlert show]; | |
} | |
} | |
- (void)createGPSNotification | |
{ | |
DLog(@"begin"); | |
if(gpsNotificationAlertView == nil) | |
{ | |
NSString* message = [NSString stringWithFormat:MESSAGE_GPS_NOTIFICATION, GPS_TIMEOUT]; | |
gpsNotificationAlertView = [[UIAlertView alloc] initWithTitle:@"GPS Notification" message:message delegate:self cancelButtonTitle:@"I will wait" otherButtonTitles:@"CANCEL", nil]; | |
UIActivityIndicatorView *activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite]; | |
activityView.frame = CGRectMake(139.0f-18.0f, 65.0f, 37.0f, 37.0f); | |
[activityView startAnimating]; | |
[gpsNotificationAlertView addSubview:activityView]; | |
[activityView release]; | |
} | |
} | |
- (void)hideProgressAlert | |
{ | |
if(progressAlert != nil) | |
{ | |
[progressAlert dismissWithClickedButtonIndex:0 animated:NO]; | |
[progressAlert release], progressAlert = nil; | |
} | |
} | |
- (void)hideGPSAlert | |
{ | |
DLog(@"begin"); | |
if(gpsNotificationAlertView != nil) | |
[gpsNotificationAlertView dismissWithClickedButtonIndex:0 animated:YES]; | |
} | |
- (void)hideAnyAlert | |
{ | |
if(!gpsNotificationAlertView.hidden) | |
[self hideGPSAlert]; | |
if(!progressAlert.hidden) | |
[self hideProgressAlert]; | |
} | |
- (void)dismissModalViewController | |
{ | |
if(self.modalViewController != nil) | |
[self dismissModalViewControllerAnimated:YES]; | |
} | |
- (void)dismissPopoverViewController | |
{ | |
if(popoverController != nil) | |
{ | |
[popoverController dismissPopoverAnimated:YES]; | |
[popoverController release], popoverController = nil; | |
[self enableToolBarState]; | |
} | |
} | |
- (void)startAnimating | |
{ | |
[self startAnimating:@"Please wait..."]; | |
} | |
- (void)startAnimating:(NSString*)_message | |
{ | |
DLog(@"startAnimating"); | |
[spinner startAnimating]; | |
[self createProgressionAlertWithMessage:_message]; | |
} | |
- (void)stopAnimating | |
{ | |
DLog(@"stopAnimating"); | |
[spinner stopAnimating]; | |
[self hideProgressAlert]; | |
} | |
- (void)toggleButtonMoreResults | |
{ | |
DLog(@"lastKnownPage: %d lastKnownTotalPages: %d", lastKnownPage, lastKnownTotalPages); | |
if(lastKnownPage < lastKnownTotalPages) | |
barButtonMoreResults.enabled = YES; | |
else | |
barButtonMoreResults.enabled = NO; | |
} | |
#pragma mark bar IBAction and public methods | |
- (IBAction)buttonHomePressed:(id)sender | |
{ | |
DLog(@"begin"); | |
[self.navigationController popToRootViewControllerAnimated:YES]; | |
} | |
- (void)buttonSearchPressed | |
{ | |
[self buttonSearchPressed:barButtonSearch]; | |
} | |
- (IBAction)buttonSearchPressed:(id)sender | |
{ | |
if([HelperDevice isDeviceAniPad]) | |
{ | |
SearchViewController *searchView = [[SearchViewController alloc] initWithNibName:[HelperDevice nibNameForDevice:@"SearchViewController"] bundle:nil withSearchModel:modelSearch]; | |
if(popoverController != nil) | |
{ | |
if([popoverController isPopoverVisible]) | |
[popoverController dismissPopoverAnimated:YES]; | |
[popoverController release], popoverController = nil; | |
} | |
popoverController = [[UIPopoverController alloc] initWithContentViewController:searchView]; | |
searchView.delegate = self; | |
popoverController.delegate = self; | |
[popoverController presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES]; | |
[searchView release]; | |
stateBoolMoreResults = barButtonMoreResults.isEnabled; | |
[self disableToolBarItems]; | |
} | |
else | |
{ | |
SearchViewController *searchView = [[SearchViewController alloc] initWithNibName:[HelperDevice nibNameForDevice:@"SearchViewController"] bundle:nil withSearchModel:modelSearch]; | |
searchView.delegate = self; | |
[searchView setModalTransitionStyle:UIModalTransitionStyleCoverVertical]; | |
[self.navigationController presentModalViewController:searchView animated:YES]; | |
[searchView release]; | |
} | |
} | |
- (void)disableToolBarItems | |
{ | |
barButtonHome.enabled = NO; | |
barButtonSearch.enabled = NO; | |
barButtonMoreResults.enabled = NO; | |
barButtonPageCurl.enabled = NO; | |
} | |
- (void)enableToolBarState | |
{ | |
barButtonHome.enabled = YES; | |
barButtonSearch.enabled = YES; | |
barButtonMoreResults.enabled = stateBoolMoreResults; | |
barButtonPageCurl.enabled = YES; | |
} | |
#pragma mark popoverController delegate Methods | |
- (BOOL)popoverControllerShouldDismissPopover:(UIPopoverController *)popoverController | |
{ | |
DLog(@"begin"); | |
[self enableToolBarState]; | |
return YES; | |
} | |
/* Called on the delegate when the user has taken action to dismiss the popover. This is not called when -dismissPopoverAnimated: is called directly. | |
*/ | |
- (void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController | |
{ | |
DLog(@"begin"); | |
} | |
- (IBAction)buttonPageCurlPressed:(id)sender | |
{ | |
DLog(@"begin"); | |
MapSettingsViewController *mapSettingsView = [[MapSettingsViewController alloc] initWithNibName:[HelperDevice nibNameForDevice:@"MapSettingsViewController"] bundle:nil]; | |
mapSettingsView.delegate = self; | |
[mapSettingsView setModalTransitionStyle:UIModalTransitionStylePartialCurl]; | |
[self presentModalViewController:mapSettingsView animated:YES]; | |
} | |
- (IBAction)flipCurrentView | |
{ | |
int buttonIndex = segmentedControl.selectedSegmentIndex; | |
DLog(@"buttonIndex: %d", buttonIndex); | |
if(buttonIndex == 0) // show Map | |
{ | |
[UIView beginAnimations:@"flipViewToMap" context:NULL]; | |
[UIView setAnimationDuration:1.0]; | |
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight | |
forView:self.view | |
cache:YES]; | |
[tableviewContent removeFromSuperview]; | |
barButtonPageCurl.enabled = YES; | |
[UIView commitAnimations]; | |
[segmentedControl setImage:[UIImage imageNamed:@"button_map_selected.png"] forSegmentAtIndex:0]; | |
[segmentedControl setImage:[UIImage imageNamed:@"button_list.png"] forSegmentAtIndex:1]; | |
} | |
else | |
{ | |
[UIView beginAnimations:@"flipViewToTableView" context:NULL]; | |
[UIView setAnimationDuration:1.0]; | |
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft | |
forView:self.view | |
cache:YES]; | |
[self.view addSubview:tableviewContent]; | |
barButtonPageCurl.enabled = NO; | |
[UIView commitAnimations]; | |
[segmentedControl setImage:[UIImage imageNamed:@"button_map.png"] forSegmentAtIndex:0]; | |
[segmentedControl setImage:[UIImage imageNamed:@"button_list_selected.png"] forSegmentAtIndex:1]; | |
} | |
} | |
#pragma mark MapSettingsViewController delegate methods | |
- (void)changeMapType:(int)_index | |
{ | |
DLog(@"index: %d", _index); | |
[self dismissModalViewController]; | |
mapview.mapType = _index; | |
} | |
- (void)showCurrentLocation{ | |
DLog(@"begin"); | |
[self dismissModalViewController]; | |
boolShowCurrentLocation = YES; | |
[self startGPS]; | |
} | |
- (void)showVirtualLocation | |
{ | |
DLog(@"begin"); | |
[self dismissModalViewController]; | |
CLLocationCoordinate2D _coordinate = mapview.centerCoordinate; | |
if(userAnnotation == nil) | |
[self addUserAnnotation:_coordinate]; | |
else | |
[userAnnotation setCoordinate:_coordinate]; | |
[modelSearch addVirtualLocation]; | |
} | |
#pragma mark SearchViewControllerDelegate methods | |
- (void)receivedSearchKeyword:(NSString*)_text | |
{ | |
DLog(@"_text: %@", _text); | |
[self dismissModalViewController]; | |
lastPage = 1; | |
if([_text isEqualToString:@"Current GPS Location"]) | |
[self nearby]; | |
else if([_text isEqualToString:@"Virtual Location"]) | |
[self initiateNearbySearchHTTPRequest]; | |
else | |
[self initiateKeywordSearchHTTPRequest:_text]; | |
} | |
- (void)cancelSearchViewController | |
{ | |
DLog(@"begin"); | |
[self.navigationController dismissModalViewControllerAnimated:YES]; | |
} | |
#pragma mark HTTP methods | |
- (void)initiateNearbySearchHTTPRequest | |
{ | |
DLog(@"begin"); | |
NSString* _message = @"Showing nearby records... "; | |
NSMutableString *strURLDirty = [[NSMutableString alloc] init]; | |
[strURLDirty appendFormat:@"%@", HTTP_NEARBY_URL]; | |
[strURLDirty appendFormat:@"&country_name=%@", [Country getName]]; | |
[strURLDirty appendFormat:@"&latitude=%f&longitude=%f", userAnnotation.coordinate.latitude, userAnnotation.coordinate.longitude]; | |
[lastURLString setString:strURLDirty]; | |
[strURLDirty appendFormat:@"&page=%d", lastPage]; | |
[self startHTTPRequest:strURLDirty]; | |
[strURLDirty release]; | |
[self startAnimating:_message]; | |
} | |
- (void)initiateNearbyPoiTypeSearchHTTPRequest:(NSString*)_poiType | |
{ | |
DLog(@"begin"); | |
NSString* _message = @"Showing nearby records... "; | |
NSMutableString *strURLDirty = [[NSMutableString alloc] init]; | |
[strURLDirty appendFormat:@"%@", HTTP_SEARCH_URL]; | |
[strURLDirty appendFormat:@"&country_name=%@", [Country getName]]; | |
if(_poiType != nil) | |
{ | |
[strURLDirty appendFormat:@"&poi_type_name=%@", _poiType]; | |
_message = [NSString stringWithFormat:@"Showing recent %@...", _poiType]; | |
} | |
[strURLDirty appendFormat:@"&latitude=%f&longitude=%f", userAnnotation.coordinate.latitude, userAnnotation.coordinate.longitude]; | |
[lastURLString setString:strURLDirty]; | |
[strURLDirty appendFormat:@"&page=%d", lastPage]; | |
[self startHTTPRequest:strURLDirty]; | |
[strURLDirty release]; | |
[self startAnimating:_message]; | |
} | |
- (void)initiateKeywordSearchHTTPRequest:(NSString*)_keyword | |
{ | |
DLog(@"_keyword: %@", _keyword); | |
NSString* _message = @"Searching"; | |
[lastKeyword setString:_keyword]; | |
NSMutableString *strURLDirty = [[NSMutableString alloc] init]; | |
[strURLDirty appendFormat:@"%@", HTTP_SEARCH_URL]; | |
[strURLDirty appendFormat:@"&country_name=%@", [Country getName]]; | |
[strURLDirty appendFormat:@"&keyword=%@", _keyword]; | |
_message = [NSString stringWithFormat:@"Searching for %@", _keyword]; | |
if(userAnnotation != nil) | |
{ | |
[strURLDirty appendFormat:@"&latitude=%f&longitude=%f", userAnnotation.coordinate.latitude, userAnnotation.coordinate.longitude]; | |
_message = [NSString stringWithFormat:@"Searching for nearby %@", _keyword]; | |
} | |
[lastURLString setString:strURLDirty]; | |
[strURLDirty appendFormat:@"&page=%d", lastPage]; | |
[self startHTTPRequest:strURLDirty]; | |
[strURLDirty release]; | |
[self startAnimating:_message]; | |
} | |
- (void)initiateRecentSearchHTTPRequest:(NSString*)_poiType | |
{ | |
DLog(@"begin"); | |
NSString* _message = @"Showing recent records... "; | |
NSMutableString *strURLDirty = [[NSMutableString alloc] init]; | |
[strURLDirty appendFormat:@"%@", HTTP_RECENT_URL]; | |
[strURLDirty appendFormat:@"&country_name=%@", [Country getName]]; | |
if(_poiType != nil) | |
{ | |
[strURLDirty appendFormat:@"&poi_type_name=%@", _poiType]; | |
_message = [NSString stringWithFormat:@"Showing recent %@...", _poiType]; | |
} | |
[lastURLString setString:strURLDirty]; | |
[strURLDirty appendFormat:@"&page=%d", lastPage]; | |
[self startHTTPRequest:strURLDirty]; | |
[strURLDirty release]; | |
[self startAnimating:_message]; | |
} | |
- (IBAction)buttonMoreResultsPressed:(id)sender | |
{ | |
lastKnownPage = lastKnownPage + 1; | |
lastPage = lastKnownPage; | |
[lastURLString setString:lastKnownURLString]; | |
[lastKnownURLString appendFormat:@"&page=%d", lastKnownPage]; | |
DLog(@"lastKnownURLString: %@", lastKnownURLString); | |
[self startHTTPRequest:lastKnownURLString]; | |
[self startAnimating:@"Showing more results..."]; | |
} | |
- (void)startHTTPRequest:(NSString *)urlDirty | |
{ | |
DLog(@"begin"); | |
NSString *strURLClean = [urlDirty stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; | |
NSURL *url = [NSURL URLWithString:strURLClean]; | |
ASIHTTPRequest* currentHTTPRequest = [ASIHTTPRequest requestWithURL:url]; | |
[currentHTTPRequest setDelegate:self]; | |
[currentHTTPRequest setDidFinishSelector:@selector(requestFinished:)]; | |
[currentHTTPRequest setDidFailSelector:@selector(requestFailed:)]; | |
[currentHTTPRequest setTimeOutSeconds:HTTP_TIMEOUT]; | |
[currentHTTPRequest startAsynchronous]; | |
DLog(@"urlDirty: %@", urlDirty); | |
} | |
- (void)requestFinished:(ASIHTTPRequest *)request | |
{ | |
DLog(@""); | |
NSData *jsonData = [request responseData]; | |
id responseRoot = [jsonData objectFromJSONData]; | |
if([responseRoot isKindOfClass:[NSDictionary class]]) | |
{ | |
totalPages = (int)[[responseRoot objectForKey:@"total_pages"] intValue]; | |
//If there are records | |
if( totalPages > 0 ) | |
{ | |
//used for appending to searchDictionary item | |
[modelSearch addToRecentSearch:lastKeyword]; | |
[lastKnownURLString setString:lastURLString]; | |
lastKnownPage = lastPage; | |
lastKnownTotalPages = totalPages; | |
DLog(@"lastKnownURLString: %@", lastKnownURLString); | |
NSMutableArray *arrayData = [[NSMutableArray alloc] initWithArray:[responseRoot objectForKey:@"data"]]; | |
if(lastPage == 1) | |
[self createDataModel:arrayData]; | |
else | |
[self appendDataModel:arrayData]; | |
[arrayData release]; | |
} | |
else | |
{ | |
[lastKeyword setString:@""]; | |
[UBAlertView showAlertWithTitle:@"Warning" message:@"Sorry, there were no records found." executeBlock:nil]; | |
} | |
[self toggleButtonMoreResults]; | |
} | |
else | |
[UBAlertView showAlertWithTitle:@"Error" message:MESSAGE_APPLICATION_ERROR executeBlock:nil]; | |
[self stopAnimating]; | |
} | |
- (void)requestFailed:(ASIHTTPRequest *)request | |
{ | |
NSError *error = [request error]; | |
NSString *message = [error localizedDescription]; | |
if( [error localizedDescription] == @"The request timed out" ){ | |
message = [NSString stringWithFormat:@"%@ (%@)", MESSAGE_NETWORK_ERROR, [error localizedDescription]]; | |
} | |
[UBAlertView showAlertWithTitle:@"Error" message:message executeBlock:nil]; | |
[self stopAnimating]; | |
} | |
- (void)createDataModel:(NSMutableArray*)_poiArray | |
{ | |
[mapview removeAnnotations:arrayPoiAnnotations]; | |
[arrayPoiAnnotations removeAllObjects]; | |
[self initMBR]; | |
[self addPoiAnnotations:_poiArray]; | |
[self zoomToFitPoiAnnotations]; | |
[tableviewContent reloadData]; | |
} | |
- (void)appendDataModel:(NSMutableArray*)_poiArray | |
{ | |
//Get the lastCount of the dataModel. We will use this in the indexPath below. | |
int lastCount = (int)[arrayPoiAnnotations count]; | |
DLog(@"arrayPoiAnnotations count: %d lastCount: %d", [arrayPoiAnnotations count], lastCount); | |
//Update the dataModel. Now we should have 20 objects | |
[self addPoiAnnotations:_poiArray startIndex:lastCount]; | |
//Create the arrayIndexPaths | |
NSMutableArray* arrayIndexPaths = [[NSMutableArray alloc] initWithObjects:nil]; | |
NSIndexPath* visibleIndexPath = nil; | |
for(int i=0;i<[_poiArray count]; i++) | |
{ | |
int _index = lastCount + i; | |
DLog(@"index: %d", _index); | |
[arrayIndexPaths addObject:[NSIndexPath indexPathForRow:_index inSection:0]]; | |
if(i==0) | |
visibleIndexPath = [NSIndexPath indexPathForRow:_index inSection:0]; | |
} | |
//Insert the indexPaths to the TableView. Note numberOfRowsInSection will be called prior to inserting the indexPaths. This means we should have the dataModel to have the correct number already, prior to inserting the indexPaths. | |
[tableviewContent insertRowsAtIndexPaths:arrayIndexPaths withRowAnimation:UITableViewRowAnimationTop]; | |
[arrayIndexPaths release]; | |
[self zoomToFitPoiAnnotations]; | |
[tableviewContent scrollToRowAtIndexPath:visibleIndexPath atScrollPosition:UITableViewScrollPositionTop animated:YES]; | |
} | |
- (void)addPoiAnnotations:(NSMutableArray*)_poiArray | |
{ | |
[self addPoiAnnotations:_poiArray startIndex:0]; | |
} | |
- (void)addPoiAnnotations:(NSMutableArray*)_poiArray startIndex:(int)_lastCount | |
{ | |
for (int i=0;i<[_poiArray count];i++) | |
{ | |
NSDictionary *_poi = [[NSDictionary alloc] initWithDictionary:[_poiArray objectAtIndex:i]]; | |
NSString* _strLatitude = [NSString stringWithFormat:@"%@", [_poi objectForKey:@"latitude"]]; | |
NSString* _strLongitude = [NSString stringWithFormat:@"%@", [_poi objectForKey:@"longitude"]]; | |
int index = _lastCount + i; | |
PoiAnnotation* poiAnnotation = [[PoiAnnotation alloc] initWithPrimaryKey:(int)[[_poi objectForKey:@"id"] intValue] withIndex:index]; | |
poiAnnotation.name = [_poi objectForKey:@"name"]; | |
poiAnnotation.address = [_poi objectForKey:@"address"]; | |
poiAnnotation.poitype = [_poi objectForKey:@"poi_type"]; | |
[poiAnnotation setLatitude:_strLatitude setLongitude:_strLongitude]; | |
poiAnnotation.distance = [_poi objectForKey:@"distance"]; | |
//poiAnnotation.distance = @"999.999 km"; | |
poiAnnotation.total_stars = [_poi objectForKey:@"total_stars"]; | |
poiAnnotation.total_ratings = [_poi objectForKey:@"total_ratings"]; | |
poiAnnotation.min_rate = [_poi objectForKey:@"min_rate"]; | |
//poiAnnotation.min_rate = @"VND 9,000,000"; | |
poiAnnotation.picture_thumb_path = [_poi objectForKey:@"picture_thumb_path"]; | |
[arrayPoiAnnotations addObject:poiAnnotation]; | |
[_poi release]; | |
[mapview addAnnotation:poiAnnotation]; | |
if([poiAnnotation hasValidCoordinates]) | |
{ | |
topLeftCoord.longitude = fmin(topLeftCoord.longitude, poiAnnotation.coordinate.longitude); | |
topLeftCoord.latitude = fmax(topLeftCoord.latitude, poiAnnotation.coordinate.latitude); | |
bottomRightCoord.longitude = fmax(bottomRightCoord.longitude, poiAnnotation.coordinate.longitude); | |
bottomRightCoord.latitude = fmin(bottomRightCoord.latitude, poiAnnotation.coordinate.latitude); | |
} | |
//DLog(@"addPoiAnnotations id:%@", [NSString stringWithFormat:@"%@ %d", [_poi objectForKey:@"id"], poiAnnotation.primaryKey]); | |
[poiAnnotation release]; | |
} | |
} | |
- (void)zoomToFitPoiAnnotations | |
{ | |
DLog(@"begin"); | |
MKCoordinateRegion region; | |
region.center.latitude = topLeftCoord.latitude - (topLeftCoord.latitude - bottomRightCoord.latitude) * 0.5; | |
region.center.longitude = topLeftCoord.longitude + (bottomRightCoord.longitude - topLeftCoord.longitude) * 0.5; | |
region.span.latitudeDelta = fabs(topLeftCoord.latitude - bottomRightCoord.latitude) * 1.5; // Add a little extra space on the sides | |
region.span.longitudeDelta = fabs(bottomRightCoord.longitude - topLeftCoord.longitude) * 1.5; // Add a little extra space on the sides | |
[mapview setRegion:region animated:YES]; | |
} | |
- (void)zoomToFitAllAnnotations | |
{ | |
DLog(@"begin"); | |
if( userAnnotation != nil) | |
{ | |
topLeftCoord.longitude = fmin(topLeftCoord.longitude, userAnnotation.coordinate.longitude); | |
topLeftCoord.latitude = fmax(topLeftCoord.latitude, userAnnotation.coordinate.latitude); | |
bottomRightCoord.longitude = fmax(bottomRightCoord.longitude, userAnnotation.coordinate.longitude); | |
bottomRightCoord.latitude = fmin(bottomRightCoord.latitude, userAnnotation.coordinate.latitude); | |
} | |
[self zoomToFitPoiAnnotations]; | |
} | |
- (void)zoomToFitUserAnnotationAndCountry | |
{ | |
if( userAnnotation != nil) | |
{ | |
topLeftCoord.longitude = fmin(topLeftCoord.longitude, userAnnotation.coordinate.longitude); | |
topLeftCoord.latitude = fmax(topLeftCoord.latitude, userAnnotation.coordinate.latitude); | |
bottomRightCoord.longitude = fmax(bottomRightCoord.longitude, [[mapPlist_ objectForKey:@"regionCenterLongitude"] floatValue]); | |
bottomRightCoord.latitude = fmin(bottomRightCoord.latitude, [[mapPlist_ objectForKey:@"regionCenterLatitude"] floatValue]); | |
} | |
[self zoomToFitPoiAnnotations]; | |
} | |
#pragma mark GPSControllerDelegate delegate methods | |
- (void)startGPS | |
{ | |
DLog(@"begin"); | |
boolGPSTimeoutActive = YES; | |
[[RMGPSController sharedInstance].locationManager startUpdatingLocation]; | |
[self performSelector:@selector(timeOutGPS) withObject:nil afterDelay:GPS_TIMEOUT]; | |
[gpsNotificationAlertView show]; | |
} | |
-(void)didUpdateToAGoodLocation:(CLLocationCoordinate2D)coordinate | |
{ | |
[self newLocationUpdate:coordinate]; | |
} | |
- (void)newLocationUpdate:(CLLocationCoordinate2D)_coordinate { | |
DLog(@"coordinate: %f %f", _coordinate.latitude, _coordinate.longitude); | |
[self stopGPS]; | |
//Add the userAnnotation if there is nothing yet else move the userAnnotation | |
if(userAnnotation == nil) | |
[self addUserAnnotation:_coordinate]; | |
else | |
[userAnnotation setCoordinate:_coordinate]; | |
if(boolShowCurrentLocation) | |
{ | |
[mapview setCenterCoordinate:_coordinate animated:YES]; | |
boolShowCurrentLocation = NO; | |
return; | |
} | |
if([self checkLocationIfWithinBounds:_coordinate]) | |
{ | |
[mapview setCenterCoordinate:_coordinate animated:YES]; | |
//This will trigger the HTTP request to get the nearby records | |
if(boolPendingRequestForNearbySearchHTTPRequest) | |
{ | |
boolPendingRequestForNearbySearchHTTPRequest = NO; | |
[self initiateNearbySearchHTTPRequest]; | |
} | |
else if(boolPendingRequestForRecentWithKeywordSearchHTTPRequest) | |
{ | |
boolPendingRequestForRecentWithKeywordSearchHTTPRequest = NO; | |
if([poiType isNotEmpty]) | |
[self initiateNearbyPoiTypeSearchHTTPRequest:poiType]; | |
} | |
} | |
else | |
{ | |
[self zoomToFitUserAnnotationAndCountry]; | |
[self showGPSAlert:@"GPS Alert" message:MESSAGE_GPS_TOO_FAR]; | |
} | |
} | |
-(void)newLocationFailedWithMessage:(NSString*)errorString withCode:(NSInteger)code | |
{ | |
DLog(@"errorString: %@", errorString); | |
[self stopGPS]; | |
NSString *message = [NSString stringWithFormat:@"%@ %@", errorString, MESSAGE_LOCATION_FAILED]; | |
[self showGPSAlert:@"Location Failed" message:message]; | |
if(boolPendingRequestForRecentWithKeywordSearchHTTPRequest) | |
{ | |
boolPendingRequestForRecentWithKeywordSearchHTTPRequest = NO; | |
if([poiType isNotEmpty]) | |
[self performSelector:@selector(initiateRecentSearchHTTPRequest:) withObject:poiType afterDelay:3]; | |
} | |
else | |
{ | |
[self performSelector:@selector(recentAll) withObject:nil afterDelay:3]; | |
} | |
} | |
- (void)stopGPS | |
{ | |
DLog(@"begin"); | |
[[RMGPSController sharedInstance].locationManager stopUpdatingLocation]; | |
[spinner stopAnimating]; | |
boolGPSTimeoutActive = NO; | |
[self hideAnyAlert]; | |
} | |
- (void)timeOutGPS{ | |
if(boolGPSTimeoutActive) | |
{ | |
DLog(@"boolGPSTimeoutActive: YES. Need to show GPS_TIMEOUT alert"); | |
[self stopGPS]; | |
[self showGPSAlert:@"GPS Alert" message:MESSAGE_GPS_TIMEOUT]; | |
} | |
else{ | |
DLog(@"boolGPSTimeoutActive: NO. will not show GPS_TIMEOUT alert"); | |
} | |
} | |
- (void)showGPSAlert:(NSString*)alertTitle message:(NSString*)_message{ | |
if(boolGPSAlertShown == NO) | |
{ | |
DLog(@"boolGPSAlertShown: NO"); | |
[HelperAlert showTitle:alertTitle message:_message delegate:self]; | |
boolGPSAlertShown = YES; | |
} | |
else | |
DLog(@"boolGPSAlertShown: YES"); | |
} | |
#pragma mark alertview delegate methods | |
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex | |
{ | |
DLog(@"buttonIndex: %d", buttonIndex); | |
boolGPSAlertShown = NO; | |
if([alertView.title isEqualToString:@"GPS Notification"]) | |
{ | |
if(buttonIndex == 0){ | |
[self startAnimating:@"Waiting for location.."]; | |
boolGPSTimeoutActive = YES; | |
} | |
else if(buttonIndex == 1){ | |
DLog(@"CANCEL"); | |
[self stopGPS]; | |
[self showVirtualLocation]; | |
} | |
} | |
else if([alertView.title isEqualToString:@"GPS Alert"]) | |
{ | |
if(boolPendingRequestForRecentWithKeywordSearchHTTPRequest) | |
{ | |
boolPendingRequestForRecentWithKeywordSearchHTTPRequest = NO; | |
if([poiType isNotEmpty]) | |
[self initiateRecentSearchHTTPRequest:poiType]; | |
} | |
else | |
{ | |
[self recentAll]; | |
} | |
} | |
} | |
#pragma mark private mapview delegate methods | |
- (BOOL)checkLocationIfWithinBounds:(CLLocationCoordinate2D)_coordinate | |
{ | |
DLog(@""); | |
CGFloat minimumLatitude = [[mapPlist_ objectForKey:@"minimumLatitude"] floatValue]; | |
CGFloat maximumLatitude = [[mapPlist_ objectForKey:@"maximumLatitude"] floatValue]; | |
CGFloat minimumLongitude = [[mapPlist_ objectForKey:@"minimumLongitude"] floatValue]; | |
CGFloat maximumLongitude = [[mapPlist_ objectForKey:@"maximumLongitude"] floatValue]; | |
return _coordinate.latitude > minimumLatitude && _coordinate.latitude < maximumLatitude && _coordinate.longitude > minimumLongitude && _coordinate.longitude < maximumLongitude ? YES : NO; | |
} | |
- (void)addUserAnnotation:(CLLocationCoordinate2D)_coordinate | |
{ | |
userAnnotation = [[UserAnnotation alloc] initWithCoordinate:_coordinate]; | |
userAnnotation.title = @"Current Location"; | |
[mapview addAnnotation:userAnnotation]; | |
} | |
- (void)initMapRegion | |
{ | |
DLog(@"initMapRegion"); | |
MKCoordinateRegion _region; | |
_region.span.latitudeDelta = [[mapPlist_ objectForKey:@"regionSpanLatitude"] floatValue]; | |
_region.span.longitudeDelta = [[mapPlist_ objectForKey:@"regionSpanLongitude"] floatValue]; | |
_region.center.latitude = [[mapPlist_ objectForKey:@"regionCenterLatitude"] floatValue]; | |
_region.center.longitude = [[mapPlist_ objectForKey:@"regionCenterLongitude"] floatValue]; | |
[mapview setRegion:_region animated:YES]; | |
[mapview regionThatFits:_region]; | |
} | |
- (void)initMBR | |
{ | |
topLeftCoord.latitude = -90; | |
topLeftCoord.longitude = 180; | |
bottomRightCoord.latitude = 90; | |
bottomRightCoord.longitude = -180; | |
} | |
#pragma mark MKMapViewDelegate delegate methods | |
- (void)mapViewWillStartLoadingMap:(MKMapView *)mapView | |
{ | |
//DLog(@"mapViewWillStartLoadingMap"); | |
} | |
- (void)mapViewDidFinishLoadingMap:(MKMapView *)mapView | |
{ | |
//DLog(@"mapViewDidFinishLoadingMap"); | |
} | |
- (void)mapViewDidFailLoadingMap:(MKMapView *)mapView withError:(NSError *)error | |
{ | |
//DLog(@"mapViewDidFailLoadingMap"); | |
} | |
- (void)mapView:(MKMapView *)mapView regionWillChangeAnimated:(BOOL)animated | |
{ | |
} | |
- (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated | |
{ | |
// MKCoordinateRegion region = mapView.region; | |
// DLog(@"latitude: %f, longitude: %f spanLatitude: %f spanLongitude: %f", region.center.latitude, region.center.longitude, region.span.latitudeDelta, region.span.longitudeDelta); | |
} | |
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation | |
{ | |
//DLog(@"viewForAnnotation"); | |
if ([annotation isKindOfClass:[UserAnnotation class]]) | |
{ | |
// Try to dequeue an existing pin view first. | |
MKAnnotationView* pinView = (MKAnnotationView*)[mapView dequeueReusableAnnotationViewWithIdentifier:@"UserAnnotationView"]; | |
UserAnnotation *_annotation = (UserAnnotation*)annotation; | |
if (!pinView) | |
{ | |
pinView = [[[MKAnnotationView alloc] initWithAnnotation:_annotation reuseIdentifier:@"UserAnnotationView"] autorelease]; | |
pinView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; | |
//[(UIButton *)pinView.rightCalloutAccessoryView addTarget:self action:@selector(openSpot:) forControlEvents:UIControlEventTouchUpInside]; | |
pinView.enabled = YES; | |
pinView.canShowCallout = YES; | |
//pinView.centerOffset = CGPointMake(7,-15); | |
pinView.rightCalloutAccessoryView = nil; | |
if( [pinView respondsToSelector:@selector(setDraggable:)]) | |
{ | |
pinView.draggable = YES; | |
_annotation.subtitle = @"Hold and Drag to Move"; | |
} | |
else{ | |
_annotation.subtitle = @"Use Drop Pin to recenter"; | |
} | |
} | |
else | |
pinView.annotation = annotation; | |
pinView.image = [UIImage imageNamed:@"blue_pin.png"]; | |
return pinView; | |
} | |
else if ([annotation isKindOfClass:[PoiAnnotation class]]) | |
{ | |
NSString *poiAnnotationViewIdentifier = nil; | |
PoiAnnotation *_annotation = (PoiAnnotation*)annotation; | |
if( [_annotation respondsToSelector:@selector(poitype)] && [_annotation.poitype isEqualToString:@"Attraction"]) | |
poiAnnotationViewIdentifier = @"PoiAnnotationViewGreen"; | |
else | |
poiAnnotationViewIdentifier = @"PoiAnnotationViewPurple"; | |
// Try to dequeue an existing pin view first. | |
MKPinAnnotationView* pinView = (MKPinAnnotationView*)[mapView dequeueReusableAnnotationViewWithIdentifier:poiAnnotationViewIdentifier]; | |
if (!pinView) | |
{ | |
// If an existing pin view was not available, create one. | |
pinView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"PoiAnnotationView"] autorelease]; | |
//DLog(@"annotation poitype:%@", [annotation poitype]); | |
if( [_annotation respondsToSelector:@selector(poitype)] && [_annotation.poitype isEqualToString:@"Attraction"]) | |
pinView.pinColor = MKPinAnnotationColorGreen; | |
else | |
pinView.pinColor = MKPinAnnotationColorPurple; | |
pinView.animatesDrop = YES; | |
pinView.canShowCallout = YES; | |
// Add a detail disclosure button to the callout if iOS > 4 | |
if( [pinView respondsToSelector:@selector(setDraggable:)]) | |
{ | |
UIButton* rightButton = [UIButton buttonWithType: UIButtonTypeDetailDisclosure]; | |
pinView.rightCalloutAccessoryView = rightButton; | |
} | |
} | |
else{ | |
pinView.annotation = annotation; | |
} | |
return pinView; | |
} | |
return nil; | |
} | |
- (void)moveAnnotation:(CLLocationCoordinate2D)_annotation | |
{ | |
CGPoint currentPoint = [mapview convertCoordinate:_annotation toPointToView:self.view]; | |
CGFloat imaginaryY = currentPoint.y - (320.0f - 230.0f); | |
CGPoint imaginaryPoint = CGPointMake(currentPoint.x, imaginaryY); | |
DLog(@"didSelectAnnotationView: currentPoint.x: %f currentPoint.y: %f imaginary.x: %f, imaginary.y: %f", currentPoint.x, currentPoint.y, currentPoint.x, imaginaryY); | |
CLLocationCoordinate2D c = [mapview convertPoint:imaginaryPoint toCoordinateFromView:self.view]; | |
[mapview setCenterCoordinate:c animated:YES]; | |
} | |
- (void)mapView:(MKMapView *)mapView didDeselectAnnotationView:(MKAnnotationView *)view | |
{ | |
DLog(@"begin"); | |
if(currentAnnotation == view.annotation && [currentAnnotation isKindOfClass:[PoiAnnotation class]]) | |
{ | |
DLog(@"didDeselectAnnotationView currentAnnotation:%d", currentAnnotation.index); | |
NSIndexPath* _indexPath = [NSIndexPath indexPathForRow:lastKnownIndexSelected inSection:0]; | |
[tableviewContent deselectRowAtIndexPath:_indexPath animated:NO]; | |
} | |
} | |
- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control | |
{ | |
DLog(@"begin"); | |
if( [HelperDevice isDeviceAniPad] ){ | |
//For iPad, determine the origin_y of current cell to show popover arrow | |
int index = (int)currentAnnotation.index; | |
NSIndexPath* _indexPath = [NSIndexPath indexPathForRow:index inSection:0]; | |
UITableViewCell*cell = (UITableViewCell*)[tableviewContent cellForRowAtIndexPath:_indexPath]; | |
DLog(@"calloutAccessoryControlTapped.cell.frame x:%f y:%f", cell.frame.origin.x, cell.frame.origin.y); | |
[self showDetailsViewController:currentAnnotation withCellFrame:cell.frame]; | |
} | |
else{ | |
[self showDetailsViewController:view.annotation]; | |
} | |
} | |
- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view | |
{ | |
DLog(@"begin"); | |
currentAnnotation = view.annotation; | |
if([currentAnnotation isKindOfClass:[PoiAnnotation class]]) | |
{ | |
int index = (int)currentAnnotation.index; | |
NSIndexPath* _indexPath = [NSIndexPath indexPathForRow:index inSection:0]; | |
DLog(@"didSelectAnnotationView %d", index); | |
//Scroll to the indexpath if it is not visible | |
UITableViewCell*cell = (UITableViewCell*)[tableviewContent cellForRowAtIndexPath:_indexPath]; | |
if( [cell isSelected] || [cell isHighlighted] ){ | |
DLog(@"cell is already selected"); | |
} | |
else{ | |
DLog(@"tableView scrollToRowAtIndexPath: %d", _indexPath.row); | |
[tableviewContent scrollToRowAtIndexPath:_indexPath atScrollPosition:UITableViewScrollPositionNone animated:NO]; | |
[tableviewContent selectRowAtIndexPath:_indexPath animated:NO scrollPosition:UITableViewScrollPositionMiddle]; | |
lastKnownIndexSelected = index; | |
} | |
} | |
} | |
#pragma mark UITableViewDelegate methods | |
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView | |
{ | |
return 1; | |
} | |
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section | |
{ | |
[HelperLogUtils rowsInSection:[arrayPoiAnnotations count] section:section]; | |
return [arrayPoiAnnotations count]; | |
} | |
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
return TABLEVIEW_CELL_HEIGHT; | |
} | |
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
//Do not implement this as we are setting the backgroundColor in cellForRowAtIndexPath | |
//cell.backgroundColor = ((ApplicationCell *)cell).useDarkBackground ? UITABLEVIEWCELL_DARK_BACKGROUND : UITABLEVIEWCELL_LIGHT_BACKGROUND; | |
} | |
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
//DLog(@"cellForRowAtIndexPath: indexPath.row:%d", indexPath.row); | |
PoiAnnotation *poi = (PoiAnnotation *)[arrayPoiAnnotations objectAtIndex:indexPath.row]; | |
HJImageView* mi; | |
NSString *CellIdentifier = @"ImageCell"; | |
ApplicationCell *cell = (ApplicationCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; | |
if (cell == nil) | |
{ | |
//DLog(@"cellForRowAtIndexPath creating cell..."); | |
cell = [[[PoiImageTableViewApplicationCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; | |
//Create a managed image view and add it to the cell (layout is very naieve) | |
mi = [[[HJImageView alloc] initWithFrame:CGRectMake(PADDING_LEFT, PADDING_TOP, TABLEVIEW_CELL_IMAGEVIEW_WIDTH, TABLEVIEW_CELL_IMAGEVIEW_HEIGHT) imageContentViewMode:UIViewContentModeScaleToFill] autorelease]; | |
mi.tag = 999; | |
[cell setPhotoUIView:mi]; | |
} | |
else{ | |
//DLog(@"cellForRowAtIndexPath dequeue for %@", CellIdentifier); | |
mi = (HJImageView*)[cell viewWithTag:999]; | |
[mi clear]; | |
} | |
//set the URL that we want the managed image view to load | |
[mi showLoadingWheel]; | |
//mi.url = [NSURL URLWithString:[poi.picture_thumb_path stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; | |
mi.url = [NSURL URLWithString:poi.picture_thumb_path]; | |
//tell the object manager to manage the managed image view, | |
//this causes the cached image to display, or the image to be loaded, cached, and displayed | |
[[ImageCache sharedInstance] manage:mi]; | |
// Display dark and light background in alternate rows -- see tableView:willDisplayCell:forRowAtIndexPath:. | |
cell.useDarkBackground = (indexPath.row % 2 == 0); | |
//cell.name = [NSString stringWithFormat:@"%d %@", indexPath.row + 1, poi.name]; | |
cell.name = poi.name; | |
cell.address = poi.address; | |
cell.distance = poi.distance; | |
cell.total_stars = poi.total_stars; | |
cell.total_ratings = poi.total_ratings; | |
cell.min_rate = poi.min_rate; | |
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton; | |
return cell; | |
} | |
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
DLog(@"begin"); | |
PoiAnnotation *poi = (PoiAnnotation *)[arrayPoiAnnotations objectAtIndex:indexPath.row]; | |
if( poi.coordinate.latitude > 0 && poi.coordinate.longitude > 0) | |
[mapview selectAnnotation:poi animated:YES]; | |
} | |
- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath | |
{ | |
//Select the cell first so that it won't go to the middle when the didSelectAnnotation triggers | |
[tableView selectRowAtIndexPath:indexPath animated:NO scrollPosition:UITableViewScrollPositionNone]; | |
DLog(@"begin"); | |
PoiAnnotation *poi = (PoiAnnotation *)[arrayPoiAnnotations objectAtIndex:indexPath.row]; | |
if( poi.coordinate.latitude > 0 && poi.coordinate.longitude > 0) | |
[mapview selectAnnotation:poi animated:YES]; | |
if([HelperDevice isDeviceAniPad]) | |
{ | |
//For iPad, determine the origin_y of current cell to show popover arrow | |
UITableViewCell*cell = (UITableViewCell*)[tableviewContent cellForRowAtIndexPath:indexPath]; | |
//DLog(@"cell.frame x:%f y:%f", cell.frame.origin.x, cell.frame.origin.y); | |
//DLog(@"scrollview.contentOffset x: %f y: %f", tableView.contentOffset.x, tableView.contentOffset.y); | |
//Get the yOffset base on the contentOffset and cell.frame.origin.y | |
CGFloat yOffset = abs(tableView.contentOffset.y - cell.frame.origin.y); | |
CGRect currentRect = CGRectMake(cell.frame.origin.x, yOffset, cell.frame.size.width, cell.frame.size.height); | |
[self showDetailsViewController:poi withCellFrame:currentRect]; | |
} | |
else | |
[self showDetailsViewController:poi]; | |
} | |
//Used for iPHone only | |
- (void)showDetailsViewController:(PoiAnnotation*)_annotation | |
{ | |
DLog(@""); | |
DetailsViewController *detailsVC = [[DetailsViewController alloc] initWithStyle:UITableViewStylePlain withPoiModel:_annotation]; | |
[detailsVC setSearchModel:modelSearch]; | |
[self.navigationController pushViewController:detailsVC animated:YES]; | |
[detailsVC release]; | |
} | |
//Used for iPad only | |
- (void)showDetailsViewController:(PoiAnnotation*)_annotation withCellFrame:(CGRect)frame | |
{ | |
DetailsViewController *detailsVC = [[DetailsViewController alloc] initWithStyle:UITableViewStylePlain withPoiModel:_annotation]; | |
detailsVC.delegate = self; | |
[detailsVC setSearchModel:modelSearch]; | |
if(popoverController != nil) | |
{ | |
if([popoverController isPopoverVisible]) | |
[popoverController dismissPopoverAnimated:YES]; | |
[popoverController release], popoverController = nil; | |
} | |
popoverController = [[UIPopoverController alloc] initWithContentViewController:detailsVC]; | |
popoverController.delegate = self; | |
DLog(@"frame: x:%f y:%f width:%f height:%f", frame.origin.x, frame.origin.y, frame.size.width, frame.size.height); | |
[popoverController presentPopoverFromRect:frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES]; | |
// Show the arrow pointing downwards until we resolve: Popover should display beside cell even | |
// if cell is lower than the first 10 records | |
// CGRect _frame = CGRectMake(330.0f, 0.0f, 320.0f, 1.0f); | |
// [popoverController presentPopoverFromRect:_frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES]; | |
[detailsVC release]; | |
stateBoolMoreResults = barButtonMoreResults.isEnabled; | |
[self disableToolBarItems]; | |
} | |
#pragma mark DetailsViewControllerDelegate methods | |
- (void)dismissAndPushViewController:(UIViewController*)vc | |
{ | |
DLog(@"begin"); | |
[self dismissModalViewController]; | |
[self dismissPopoverViewController]; | |
[self.navigationController pushViewController:vc animated:YES]; | |
} | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)zoomToFitPoiAnnotations | |
{ | |
DLog(@"begin"); | |
MKCoordinateRegion region; | |
region.center.latitude = topLeftCoord.latitude - (topLeftCoord.latitude - bottomRightCoord.latitude) * 0.5; | |
region.center.longitude = topLeftCoord.longitude + (bottomRightCoord.longitude - topLeftCoord.longitude) * 0.5; | |
region.span.latitudeDelta = fabs(topLeftCoord.latitude - bottomRightCoord.latitude) * 1.5; // Add a little extra space on the sides | |
region.span.longitudeDelta = fabs(bottomRightCoord.longitude - topLeftCoord.longitude) * 1.5; // Add a little extra space on the sides | |
[mapview setRegion:region animated:YES]; | |
} | |
- (void)zoomToFitAllAnnotations | |
{ | |
DLog(@"begin"); | |
if( userAnnotation != nil) | |
{ | |
topLeftCoord.longitude = fmin(topLeftCoord.longitude, userAnnotation.coordinate.longitude); | |
topLeftCoord.latitude = fmax(topLeftCoord.latitude, userAnnotation.coordinate.latitude); | |
bottomRightCoord.longitude = fmax(bottomRightCoord.longitude, userAnnotation.coordinate.longitude); | |
bottomRightCoord.latitude = fmin(bottomRightCoord.latitude, userAnnotation.coordinate.latitude); | |
} | |
[self zoomToFitPoiAnnotations]; | |
} | |
- (void)zoomToFitUserAnnotationAndCountry | |
{ | |
if( userAnnotation != nil) | |
{ | |
topLeftCoord.longitude = fmin(topLeftCoord.longitude, userAnnotation.coordinate.longitude); | |
topLeftCoord.latitude = fmax(topLeftCoord.latitude, userAnnotation.coordinate.latitude); | |
bottomRightCoord.longitude = fmax(bottomRightCoord.longitude, [[mapPlist_ objectForKey:@"regionCenterLongitude"] floatValue]); | |
bottomRightCoord.latitude = fmin(bottomRightCoord.latitude, [[mapPlist_ objectForKey:@"regionCenterLatitude"] floatValue]); | |
} | |
[self zoomToFitPoiAnnotations]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment