The Test Version.

This commit is contained in:
Saturn&Eric 2017-01-27 03:56:36 +08:00
parent 47ea048868
commit 9c8094b91a
19 changed files with 507 additions and 4 deletions

View File

@ -15,6 +15,13 @@
070A8D0D1E389EAE00EA67A3 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 070A8D0B1E389EAE00EA67A3 /* LaunchScreen.storyboard */; };
070A8D181E389EAE00EA67A3 /* MPSETests.m in Sources */ = {isa = PBXBuildFile; fileRef = 070A8D171E389EAE00EA67A3 /* MPSETests.m */; };
070A8D231E389EAE00EA67A3 /* MPSEUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 070A8D221E389EAE00EA67A3 /* MPSEUITests.m */; };
070A8D331E38A96D00EA67A3 /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 070A8D321E38A96D00EA67A3 /* CoreLocation.framework */; };
070A8D351E38B73A00EA67A3 /* Map.m in Sources */ = {isa = PBXBuildFile; fileRef = 070A8D341E38B73A00EA67A3 /* Map.m */; };
070A8D381E38B96D00EA67A3 /* MapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 070A8D371E38B96D00EA67A3 /* MapKit.framework */; };
0768B3651E39A9CD0063CC0A /* User.m in Sources */ = {isa = PBXBuildFile; fileRef = 0768B3641E39A9CD0063CC0A /* User.m */; };
07F817A71E3A210700EDEC0E /* ME.png in Resources */ = {isa = PBXBuildFile; fileRef = 07F817A61E3A210700EDEC0E /* ME.png */; };
07F817AB1E3A226500EDEC0E /* PointType.png in Resources */ = {isa = PBXBuildFile; fileRef = 07F817AA1E3A226500EDEC0E /* PointType.png */; };
07F817AD1E3A22E500EDEC0E /* PointType.ico in Resources */ = {isa = PBXBuildFile; fileRef = 07F817AC1E3A22E500EDEC0E /* PointType.ico */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@ -51,6 +58,16 @@
070A8D1E1E389EAE00EA67A3 /* MPSEUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MPSEUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
070A8D221E389EAE00EA67A3 /* MPSEUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MPSEUITests.m; sourceTree = "<group>"; };
070A8D241E389EAE00EA67A3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
070A8D321E38A96D00EA67A3 /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; };
070A8D341E38B73A00EA67A3 /* Map.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Map.m; sourceTree = "<group>"; };
070A8D361E38B74400EA67A3 /* Map.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Map.h; sourceTree = "<group>"; };
070A8D371E38B96D00EA67A3 /* MapKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MapKit.framework; path = System/Library/Frameworks/MapKit.framework; sourceTree = SDKROOT; };
0768B3621E39A9AA0063CC0A /* User.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = User.h; sourceTree = "<group>"; };
0768B3641E39A9CD0063CC0A /* User.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = User.m; sourceTree = "<group>"; };
07F817A61E3A210700EDEC0E /* ME.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = ME.png; sourceTree = "<group>"; };
07F817AA1E3A226500EDEC0E /* PointType.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = PointType.png; sourceTree = "<group>"; };
07F817AC1E3A22E500EDEC0E /* PointType.ico */ = {isa = PBXFileReference; lastKnownFileType = image.ico; path = PointType.ico; sourceTree = "<group>"; };
07F817AE1E3A50F800EDEC0E /* Post.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Post.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -58,6 +75,8 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
070A8D381E38B96D00EA67A3 /* MapKit.framework in Frameworks */,
070A8D331E38A96D00EA67A3 /* CoreLocation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -85,6 +104,7 @@
070A8D161E389EAE00EA67A3 /* MPSETests */,
070A8D211E389EAE00EA67A3 /* MPSEUITests */,
070A8CFB1E389EAD00EA67A3 /* Products */,
070A8D311E38A96D00EA67A3 /* Frameworks */,
);
sourceTree = "<group>";
};
@ -101,6 +121,8 @@
070A8CFC1E389EAD00EA67A3 /* MPSE */ = {
isa = PBXGroup;
children = (
0768B3631E39A9AF0063CC0A /* User */,
070A8D301E38A54900EA67A3 /* Map */,
070A8D001E389EAD00EA67A3 /* AppDelegate.h */,
070A8D011E389EAD00EA67A3 /* AppDelegate.m */,
070A8D031E389EAD00EA67A3 /* ViewController.h */,
@ -117,6 +139,9 @@
070A8CFD1E389EAD00EA67A3 /* Supporting Files */ = {
isa = PBXGroup;
children = (
07F817A61E3A210700EDEC0E /* ME.png */,
07F817AC1E3A22E500EDEC0E /* PointType.ico */,
07F817AA1E3A226500EDEC0E /* PointType.png */,
070A8CFE1E389EAD00EA67A3 /* main.m */,
);
name = "Supporting Files";
@ -140,6 +165,34 @@
path = MPSEUITests;
sourceTree = "<group>";
};
070A8D301E38A54900EA67A3 /* Map */ = {
isa = PBXGroup;
children = (
070A8D341E38B73A00EA67A3 /* Map.m */,
070A8D361E38B74400EA67A3 /* Map.h */,
);
name = Map;
sourceTree = "<group>";
};
070A8D311E38A96D00EA67A3 /* Frameworks */ = {
isa = PBXGroup;
children = (
070A8D371E38B96D00EA67A3 /* MapKit.framework */,
070A8D321E38A96D00EA67A3 /* CoreLocation.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
0768B3631E39A9AF0063CC0A /* User */ = {
isa = PBXGroup;
children = (
07F817AE1E3A50F800EDEC0E /* Post.h */,
0768B3621E39A9AA0063CC0A /* User.h */,
0768B3641E39A9CD0063CC0A /* User.m */,
);
name = User;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@ -246,9 +299,12 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
07F817A71E3A210700EDEC0E /* ME.png in Resources */,
070A8D0D1E389EAE00EA67A3 /* LaunchScreen.storyboard in Resources */,
070A8D0A1E389EAE00EA67A3 /* Assets.xcassets in Resources */,
070A8D081E389EAD00EA67A3 /* Main.storyboard in Resources */,
07F817AB1E3A226500EDEC0E /* PointType.png in Resources */,
07F817AD1E3A22E500EDEC0E /* PointType.ico in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -273,8 +329,10 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0768B3651E39A9CD0063CC0A /* User.m in Sources */,
070A8D051E389EAD00EA67A3 /* ViewController.m in Sources */,
070A8D021E389EAD00EA67A3 /* AppDelegate.m in Sources */,
070A8D351E38B73A00EA67A3 /* Map.m in Sources */,
070A8CFF1E389EAD00EA67A3 /* main.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -505,6 +563,7 @@
070A8D291E389EAE00EA67A3 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
070A8D2A1E389EAE00EA67A3 /* Build configuration list for PBXNativeTarget "MPSETests" */ = {
isa = XCConfigurationList;
@ -513,6 +572,7 @@
070A8D2C1E389EAE00EA67A3 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
070A8D2D1E389EAE00EA67A3 /* Build configuration list for PBXNativeTarget "MPSEUITests" */ = {
isa = XCConfigurationList;
@ -521,6 +581,7 @@
070A8D2F1E389EAE00EA67A3 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};

View File

@ -5,6 +5,22 @@
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "070A8CF91E389EAD00EA67A3"
BuildableName = "MPSE.app"
BlueprintName = "MPSE"
ReferencedContainer = "container:MPSE.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
@ -12,7 +28,36 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "070A8D121E389EAE00EA67A3"
BuildableName = "MPSETests.xctest"
BlueprintName = "MPSETests"
ReferencedContainer = "container:MPSE.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "070A8D1D1E389EAE00EA67A3"
BuildableName = "MPSEUITests.xctest"
BlueprintName = "MPSEUITests"
ReferencedContainer = "container:MPSE.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "070A8CF91E389EAD00EA67A3"
BuildableName = "MPSE.app"
BlueprintName = "MPSE"
ReferencedContainer = "container:MPSE.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
@ -26,6 +71,16 @@
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "070A8CF91E389EAD00EA67A3"
BuildableName = "MPSE.app"
BlueprintName = "MPSE"
ReferencedContainer = "container:MPSE.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
@ -35,6 +90,16 @@
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "070A8CF91E389EAD00EA67A3"
BuildableName = "MPSE.app"
BlueprintName = "MPSE"
ReferencedContainer = "container:MPSE.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">

View File

@ -7,6 +7,7 @@
//
#import "AppDelegate.h"
#import "User.h"
@interface AppDelegate ()
@ -17,6 +18,7 @@
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
return YES;
}

View File

@ -1,5 +1,15 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",

View File

@ -1,14 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="15G1217" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11106"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="" sceneMemberID="viewController">
<viewController id="BYZ-38-t0r" customClass="ViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
@ -16,11 +20,91 @@
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<containerView opaque="NO" contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="lIA-Cw-fve">
<rect key="frame" x="0.0" y="284" width="375" height="383"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<connections>
<segue destination="F8D-2s-aNJ" kind="embed" id="n13-fX-LIN"/>
</connections>
</containerView>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="raG-41-ikj">
<rect key="frame" x="293" y="237" width="66" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<state key="normal" title="Button">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="ShareClick:" destination="BYZ-38-t0r" eventType="touchUpInside" id="iXa-fw-ICN"/>
</connections>
</button>
<navigationBar contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="VBK-EO-4jN">
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<textAttributes key="titleTextAttributes">
<offsetWrapper key="textShadowOffset" horizontal="0.0" vertical="0.0"/>
</textAttributes>
<items>
<navigationItem title="Title" id="e8d-iI-SwZ">
<barButtonItem key="rightBarButtonItem" title="Item" id="Nq0-Dn-Zx7"/>
</navigationItem>
</items>
</navigationBar>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dGH-ch-S7e">
<rect key="frame" x="16" y="237" width="278" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="yx6-nU-6ou">
<rect key="frame" x="0.0" y="81" width="375" height="148"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" name=".AppleSystemUIFont" family=".AppleSystemUIFont" pointSize="14"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences" autocorrectionType="yes" spellCheckingType="yes"/>
</textView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<connections>
<outlet property="LocationLabel" destination="dGH-ch-S7e" id="GMl-sD-xVF"/>
<outlet property="ShareButton" destination="raG-41-ikj" id="iRv-ML-cfa"/>
<outlet property="ShareText" destination="yx6-nU-6ou" id="hxB-Tr-C70"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="128.80000000000001" y="53.523238380809602"/>
</scene>
<!--Map Delegate-->
<scene sceneID="ctx-WF-MVe">
<objects>
<viewController id="F8D-2s-aNJ" customClass="MapDelegate" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="BUT-2B-6vr"/>
<viewControllerLayoutGuide type="bottom" id="F2h-ZB-mag"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="iZ8-dL-F8N">
<rect key="frame" x="0.0" y="0.0" width="375" height="383"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<mapView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" fixedFrame="YES" mapType="standard" translatesAutoresizingMaskIntoConstraints="NO" id="t3q-fN-iR7">
<rect key="frame" x="0.0" y="0.0" width="375" height="383"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</mapView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
<navigationItem key="navigationItem" id="w6o-mA-7S7"/>
<connections>
<outlet property="MapNear" destination="t3q-fN-iR7" id="7UQ-Lq-wts"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Elk-jG-JqO" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="901.60000000000002" y="180.35982008995504"/>
</scene>
</scenes>
</document>

View File

@ -4,6 +4,8 @@
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>我们想获取你的现在的位置</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>

BIN
MPSE/ME.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

15
MPSE/Map.h Normal file
View File

@ -0,0 +1,15 @@
//
// Map.h
// MPSE
//
// Created by Saturneric on 17/1/25.
// Copyright © 2017年 Bakantu Eric. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
#import <MapKit/MKAnnotation.h>
@interface MapDelegate : UIViewController<MKMapViewDelegate>
@end

128
MPSE/Map.m Normal file
View File

@ -0,0 +1,128 @@
//
// Map.m
// MPSE
//
// Created by Saturneric on 17/1/25.
// Copyright © 2017 Bakantu Eric. All rights reserved.
//
#import "Map.h"
#import "Post.h"
@interface MapDelegate(){
UIImage * UserImagine;
UIImage * PointImagine;
NSString * UserID;
NSString * PostID;
}
@property (weak, nonatomic) IBOutlet MKMapView *MapNear;
@property (strong, nonatomic) MKPointAnnotation<MKAnnotation> *AnnotationPointTarget;
@property (nonatomic) CLLocationCoordinate2D MyLocationNow;
@end
@implementation MapDelegate
@synthesize MapNear = _MapNear;
@synthesize AnnotationPointTarget = _AnnotationPointTarget;
@synthesize MyLocationNow = _MyLocationNow;
-(void)viewDidLoad{
[super viewDidLoad];
_MapNear.delegate = self;
_MapNear.scrollEnabled = YES;
_MapNear.zoomEnabled = YES;
_MapNear.rotateEnabled = YES;
_MapNear.showsBuildings = YES;
_MapNear.userTrackingMode = MKUserTrackingModeFollow;
_MapNear.showsUserLocation = YES;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(MapAddAnnotation:) name:@"MapAddTarget" object:nil];
_MyLocationNow = CLLocationCoordinate2DMake(39.547,116.2317);
_MapNear.region = MKCoordinateRegionMake(_MyLocationNow, MKCoordinateSpanMake(0.006, 0.006));
MKMapCamera *MySeeCamera = [MKMapCamera cameraLookingAtCenterCoordinate:_MyLocationNow fromEyeCoordinate:_MyLocationNow eyeAltitude:20000 ];
_MapNear.camera = MySeeCamera;
PointImagine = [UIImage imageNamed:@"PointType.ico"];
}
-(void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation{
self.MyLocationNow = userLocation.coordinate;
_MapNear.region = MKCoordinateRegionMake(_MyLocationNow, MKCoordinateSpanMake(0.006, 0.006));
MKMapCamera *MySeeCamera = [MKMapCamera cameraLookingAtCenterCoordinate:_MyLocationNow fromEyeCoordinate:_MyLocationNow eyeAltitude:500 ];
_MapNear.camera = MySeeCamera;
}
-(void)MapAddAnnotation:(NSNotification *) Notification{
NSArray *SharePost = Notification.object;
self.AnnotationPointTarget = [[MKPointAnnotation alloc] init];
[_AnnotationPointTarget setTitle: [SharePost objectAtIndex:0]];
if ([[SharePost objectAtIndex:1] length] >25){
[_AnnotationPointTarget setSubtitle:[SharePost objectAtIndex:1]];
}
else{
[_AnnotationPointTarget setSubtitle:[SharePost objectAtIndex:1]];
}
UserImagine = [SharePost objectAtIndex:2];
_AnnotationPointTarget.coordinate = _MyLocationNow;
[_MapNear addAnnotation:_AnnotationPointTarget];
}
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation{
if([annotation isKindOfClass:[MKUserLocation class]]) return nil;
if([annotation isKindOfClass:[MKPointAnnotation class]]){
MKAnnotationView *DefineView = (MKAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:@"ShareBy"];
if(!DefineView){
DefineView = [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"ShareBy"];
[DefineView setImage:PointImagine];
DefineView.canShowCallout = YES;
UIView *LeftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 50, 50)];
UIImage *TargetUserImagine = UserImagine;
UIImageView *TargetImagineView = [[UIImageView alloc] initWithImage:TargetUserImagine];
[TargetImagineView setFrame:CGRectMake(0, 0, 50, 50)];
UIButton *DetailButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
DetailButton.frame = CGRectMake(0, 0, 50, 50);
DetailButton.backgroundColor = [UIColor clearColor];
[DetailButton setTitle:@"详情" forState:UIControlStateNormal];
NSArray *ThisAnnotationDetail = [[NSArray alloc] initWithObjects:annotation,TargetImagineView, nil];
[DetailButton addTarget:self action: @selector(DetailButtonOnClick:) forControlEvents:UIControlEventTouchUpInside];
TargetImagineView.contentMode = UIViewContentModeScaleToFill;
[LeftView addSubview:TargetImagineView];
[DefineView setLeftCalloutAccessoryView:LeftView];
[DefineView setRightCalloutAccessoryView:DetailButton];
[DefineView setDetailCalloutAccessoryView:DetailButton];
DefineView.canShowCallout = YES;
}
return DefineView;
}
return nil;
}
- (void)DetailButtonOnClick:(UIButton *) button{
}
-(void)viewDidDisappear:(BOOL)animated{
[super viewDidDisappear:animated];
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
@end

BIN
MPSE/PointType.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

BIN
MPSE/PointType.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

17
MPSE/Post.h Normal file
View File

@ -0,0 +1,17 @@
//
// Post.h
// MPSE
//
// Created by Saturneric on 17/1/26.
// Copyright © 2017年 Bakantu Eric. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface MSPost : NSObject
@property(nonatomic) NSString *UserID;
@property(nonatomic) NSString *PostID;
@property(nonatomic) NSString *Text;
@end

46
MPSE/User.h Normal file
View File

@ -0,0 +1,46 @@
//
// User.h
// MPSE
//
// Created by Saturneric on 17/1/26.
// Copyright © 2017年 Bakantu Eric. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface MSUserMe : NSObject
@property(nonatomic) NSString *UserID;
@property(nonatomic) NSString *UserName;
@property(strong, nonatomic) UIImage *UserImage;
@property(strong, nonatomic) UIImage *UserPointType;
@property(strong, nonatomic) NSDictionary *UserInfoDetail;
@property(strong, nonatomic) NSString *UserPasswrodHash;
@end
@interface MSLoginMe : NSObject
@property(nonatomic, weak) MSUserMe *targetUser;
- (void)doLogin;
- (void)ifLoginSuccess:(MSUserMe *) userInfo;
- (void)ifLoginFailed:(NSString *)error;
@end
@interface MSRegisterMe : NSObject
- (void)doRegister;
- (void)ifRegisterSuccess;
@end
@interface MSConnectServer : NSObject
@property (nonatomic ,weak) NSString *serverIP;
@property (nonatomic ,weak) NSString *serverPort;
@property (nonatomic, weak) NSString *serverCode;
@end

9
MPSE/User.m Normal file
View File

@ -0,0 +1,9 @@
//
// User.m
// MPSE
//
// Created by Saturneric on 17/1/26.
// Copyright © 2017 Bakantu Eric. All rights reserved.
//
#import "User.h"

View File

@ -7,8 +7,11 @@
//
#import <UIKit/UIKit.h>
#include <CoreLocation/CoreLocation.h>
@interface ViewController : UIViewController
#import "Post.h"
@interface ViewController : UIViewController<UITextViewDelegate, CLLocationManagerDelegate>
@end

View File

@ -10,15 +10,76 @@
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UITextView *ShareText;
@property (weak, nonatomic) IBOutlet UIButton *ShareButton;
@property (weak, nonatomic) IBOutlet UILabel *LocationLabel;
@property (strong, nonatomic) CLLocation *ShareLocationNow;
@property (strong,nonatomic) CLLocationManager *Location;
@end
@implementation ViewController
@synthesize ShareButton = _ShareButton;
@synthesize ShareText = _ShareText;
@synthesize Location = _Location;
@synthesize ShareLocationNow = _ShareLocationNow;
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[[_ShareButton titleLabel] setText:@"分享"];
_ShareText.text = @"你所在的位置有没有什么新鲜事?";
_LocationLabel.text = @"";
_ShareText.delegate = self;
_Location = [[CLLocationManager alloc]init];
_Location.delegate = self;
_Location.desiredAccuracy = kCLLocationAccuracyBest;
[_Location requestWhenInUseAuthorization];
[_Location startUpdatingLocation];
[self.view endEditing:YES];
}
- (void)textViewDidBeginEditing:(UITextView *)textView{
_ShareText.text = @"";
}
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray<CLLocation *> *)locations{
CLLocation *LocationNow = [locations lastObject];
CLGeocoder *GeocoderNow = [[CLGeocoder alloc] init];
[GeocoderNow reverseGeocodeLocation:LocationNow completionHandler:^(NSArray *array, NSError *error){
if(array.count > 0){
CLPlacemark *PlacemarkNow = [array objectAtIndex:0];
NSDictionary *Address = PlacemarkNow.addressDictionary;
NSString *LableDisplay = [[NSString alloc] initWithFormat:@"%@, %@",[Address valueForKey:@"Name"],[Address valueForKey:@"Country"]];
[_LocationLabel setText: LableDisplay];
self.ShareLocationNow = LocationNow;
}
}];
}
- (IBAction)ShareClick:(id)sender {
NSString *ShareTextNow = _ShareText.text;
NSString *Username = @"Me";
UIImage *UserImagine = [UIImage imageNamed:@"Me.png"];
NSUUID *PostID = [[NSUUID alloc] init];
NSArray *SharePost = [[NSArray alloc] initWithObjects:Username,ShareTextNow,UserImagine,nil];
[[NSNotificationCenter defaultCenter] postNotificationName:@"MapAddTarget" object:SharePost];
[[[UIApplication sharedApplication] keyWindow] endEditing:YES];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];