diff --git a/DerivedData/MPSE/Index/Debug/iphonesimulator10.2-x86_64/MPSE.xcindex/db.xcindexdb b/DerivedData/MPSE/Index/Debug/iphonesimulator10.2-x86_64/MPSE.xcindex/db.xcindexdb index 56a3b0e..c83b4ac 100644 Binary files a/DerivedData/MPSE/Index/Debug/iphonesimulator10.2-x86_64/MPSE.xcindex/db.xcindexdb and b/DerivedData/MPSE/Index/Debug/iphonesimulator10.2-x86_64/MPSE.xcindex/db.xcindexdb differ diff --git a/DerivedData/MPSE/Index/Debug/iphonesimulator10.2-x86_64/MPSE.xcindex/db.xcindexdb-wal b/DerivedData/MPSE/Index/Debug/iphonesimulator10.2-x86_64/MPSE.xcindex/db.xcindexdb-wal index 2ed1fef..34e15c9 100644 Binary files a/DerivedData/MPSE/Index/Debug/iphonesimulator10.2-x86_64/MPSE.xcindex/db.xcindexdb-wal and b/DerivedData/MPSE/Index/Debug/iphonesimulator10.2-x86_64/MPSE.xcindex/db.xcindexdb-wal differ diff --git a/MPSE.xcodeproj/project.pbxproj b/MPSE.xcodeproj/project.pbxproj index 30bfea9..de3db41 100644 --- a/MPSE.xcodeproj/project.pbxproj +++ b/MPSE.xcodeproj/project.pbxproj @@ -22,6 +22,7 @@ 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 */; }; + 07F817B21E3A995600EDEC0E /* Detail.m in Sources */ = {isa = PBXBuildFile; fileRef = 07F817B11E3A995600EDEC0E /* Detail.m */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -68,6 +69,8 @@ 07F817AA1E3A226500EDEC0E /* PointType.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = PointType.png; sourceTree = ""; }; 07F817AC1E3A22E500EDEC0E /* PointType.ico */ = {isa = PBXFileReference; lastKnownFileType = image.ico; path = PointType.ico; sourceTree = ""; }; 07F817AE1E3A50F800EDEC0E /* Post.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Post.h; sourceTree = ""; }; + 07F817B01E3A994C00EDEC0E /* Detail.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Detail.h; sourceTree = ""; }; + 07F817B11E3A995600EDEC0E /* Detail.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Detail.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -121,6 +124,7 @@ 070A8CFC1E389EAD00EA67A3 /* MPSE */ = { isa = PBXGroup; children = ( + 07F817AF1E3A993F00EDEC0E /* Detail */, 0768B3631E39A9AF0063CC0A /* User */, 070A8D301E38A54900EA67A3 /* Map */, 070A8D001E389EAD00EA67A3 /* AppDelegate.h */, @@ -193,6 +197,15 @@ name = User; sourceTree = ""; }; + 07F817AF1E3A993F00EDEC0E /* Detail */ = { + isa = PBXGroup; + children = ( + 07F817B01E3A994C00EDEC0E /* Detail.h */, + 07F817B11E3A995600EDEC0E /* Detail.m */, + ); + name = Detail; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -331,6 +344,7 @@ files = ( 0768B3651E39A9CD0063CC0A /* User.m in Sources */, 070A8D051E389EAD00EA67A3 /* ViewController.m in Sources */, + 07F817B21E3A995600EDEC0E /* Detail.m in Sources */, 070A8D021E389EAD00EA67A3 /* AppDelegate.m in Sources */, 070A8D351E38B73A00EA67A3 /* Map.m in Sources */, 070A8CFF1E389EAD00EA67A3 /* main.m in Sources */, diff --git a/MPSE/Base.lproj/Main.storyboard b/MPSE/Base.lproj/Main.storyboard index 139336d..1b1d574 100644 --- a/MPSE/Base.lproj/Main.storyboard +++ b/MPSE/Base.lproj/Main.storyboard @@ -6,9 +6,28 @@ + + + + + + + + + + + + + + + + + + + @@ -21,17 +40,18 @@ - + - - - + - - + + + + + - + + + + + + + + + + + + + + + + + + @@ -78,6 +123,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -90,12 +232,17 @@ - + - + + + + + + @@ -107,4 +254,7 @@ + + + diff --git a/MPSE/Detail.h b/MPSE/Detail.h new file mode 100644 index 0000000..dc9b7a3 --- /dev/null +++ b/MPSE/Detail.h @@ -0,0 +1,21 @@ +// +// Detail.h +// MPSE +// +// Created by Saturneric on 17/1/27. +// Copyright © 2017年 Bakantu Eric. All rights reserved. +// + +#import +#import "Post.h" + +@interface DetailViewDelegate : UIViewController + +@property (strong ,nonatomic) MSPost *ThisPost; +@property (weak, nonatomic) IBOutlet UILabel *UserName; +@property (weak, nonatomic) IBOutlet UILabel *Time; +@property (weak, nonatomic) IBOutlet UIImageView *UserImgine; +@property (weak, nonatomic) IBOutlet UITextView *PostText; +@property (weak, nonatomic) IBOutlet UINavigationBar *TopBar; + +@end diff --git a/MPSE/Detail.m b/MPSE/Detail.m new file mode 100644 index 0000000..0175718 --- /dev/null +++ b/MPSE/Detail.m @@ -0,0 +1,33 @@ +// +// Detail.m +// MPSE +// +// Created by Saturneric on 17/1/27. +// Copyright © 2017年 Bakantu Eric. All rights reserved. +// + +#import "Detail.h" + +@interface DetailViewDelegate() + +@end + +@implementation DetailViewDelegate + +@synthesize ThisPost= _ThisPost; +@synthesize UserName = _UserName; +@synthesize Time = _Time; +@synthesize PostText = _PostText; +@synthesize TopBar = _TopBar; + +- (void)viewDidLoad{ + [super viewDidLoad]; + [_UserName setText:_ThisPost.Username]; + _Time.text = _ThisPost.Time; + _PostText.text = [NSString stringWithFormat:@" %@",_ThisPost.Text]; +} +- (void)viewDidDisappear:(BOOL)animated{ + [super viewDidDisappear:animated]; +} + +@end diff --git a/MPSE/Map.h b/MPSE/Map.h index 112c255..3b8939d 100644 --- a/MPSE/Map.h +++ b/MPSE/Map.h @@ -8,8 +8,16 @@ #import #import #import +#import "Post.h"; @interface MapDelegate : UIViewController @end + + +@interface MKAnnotationViewPlus : MKAnnotationView + +@property(strong,nonatomic) MSPost *Post; + +@end diff --git a/MPSE/Map.m b/MPSE/Map.m index e599681..8f4b542 100644 --- a/MPSE/Map.m +++ b/MPSE/Map.m @@ -7,19 +7,24 @@ // #import "Map.h" -#import "Post.h" +#import "Detail.h" + +@implementation MKAnnotationViewPlus + + +@end @interface MapDelegate(){ UIImage * UserImagine; UIImage * PointImagine; - NSString * UserID; - NSString * PostID; } @property (weak, nonatomic) IBOutlet MKMapView *MapNear; @property (strong, nonatomic) MKPointAnnotation *AnnotationPointTarget; @property (nonatomic) CLLocationCoordinate2D MyLocationNow; +@property (strong, nonatomic) MSPost *ThisPost; +@property (strong, nonatomic) MKAnnotationViewPlus *SelectedAnnotationView; @end @@ -62,28 +67,27 @@ } -(void)MapAddAnnotation:(NSNotification *) Notification{ - NSArray *SharePost = Notification.object; + MSPost *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]; + self.ThisPost = SharePost; + + //Need to be rewrite + [_AnnotationPointTarget setTitle: @"ME"]; + UserImagine = [UIImage imageNamed:@"ME.png"]; + + _AnnotationPointTarget.subtitle = self.ThisPost.Text; _AnnotationPointTarget.coordinate = _MyLocationNow; [_MapNear addAnnotation:_AnnotationPointTarget]; } -- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id )annotation{ +- (MKAnnotationViewPlus *)mapView:(MKMapView *)mapView viewForAnnotation:(id )annotation{ if([annotation isKindOfClass:[MKUserLocation class]]) return nil; if([annotation isKindOfClass:[MKPointAnnotation class]]){ - MKAnnotationView *DefineView = (MKAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:@"ShareBy"]; + MKAnnotationViewPlus *DefineView = (MKAnnotationViewPlus *)[mapView dequeueReusableAnnotationViewWithIdentifier:@"ShareBy"]; if(!DefineView){ - DefineView = [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"ShareBy"]; + DefineView = [[MKAnnotationViewPlus alloc] initWithAnnotation:annotation reuseIdentifier:@"ShareBy"]; [DefineView setImage:PointImagine]; DefineView.canShowCallout = YES; @@ -97,18 +101,23 @@ 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]; + //NSArray *ThisAnnotationDetail = [[NSArray alloc] initWithObjects:annotation,TargetImagineView, nil]; + + UILabel *DescribtionText = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 120, 80)]; + DescribtionText.text = self.ThisPost.Text; + [DescribtionText setNumberOfLines:5]; + DescribtionText.font = [UIFont fontWithName:@"System" size:4]; + + TargetImagineView.contentMode = UIViewContentModeScaleToFill; [LeftView addSubview:TargetImagineView]; [DefineView setLeftCalloutAccessoryView:LeftView]; [DefineView setRightCalloutAccessoryView:DetailButton]; - [DefineView setDetailCalloutAccessoryView:DetailButton]; + [DefineView setDetailCalloutAccessoryView:DescribtionText]; DefineView.canShowCallout = YES; + DefineView.Post = self.ThisPost; } return DefineView; } @@ -116,6 +125,19 @@ } - (void)DetailButtonOnClick:(UIButton *) button{ + UIStoryboard *MainStoryBroad = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]]; + + DetailViewDelegate *ThisDetailView = [MainStoryBroad instantiateViewControllerWithIdentifier:@"DetailViewSelected"]; + + ThisDetailView.ThisPost = self.SelectedAnnotationView.Post; + NSLog(@"%@",self.SelectedAnnotationView.Post); + [self presentViewController:ThisDetailView animated:YES completion:^{}]; + +} + +-(void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationViewPlus *)view +{ + self.SelectedAnnotationView = view; } diff --git a/MPSE/Post.h b/MPSE/Post.h index f87b476..18ed89c 100644 --- a/MPSE/Post.h +++ b/MPSE/Post.h @@ -7,11 +7,15 @@ // #import +#import @interface MSPost : NSObject @property(nonatomic) NSString *UserID; @property(nonatomic) NSString *PostID; +@property(nonatomic) NSString *Username; @property(nonatomic) NSString *Text; +@property(nonatomic) NSString *Time; +@property(nonatomic) CLLocationCoordinate2D *Location; @end diff --git a/MPSE/User.h b/MPSE/User.h index c1537d2..b13194f 100644 --- a/MPSE/User.h +++ b/MPSE/User.h @@ -43,4 +43,15 @@ @property (nonatomic, weak) NSString *serverCode; +@end + +@interface MSAskForImagine : NSObject + +@property(strong,nonatomic)NSString *UserID; +@property(strong,nonatomic)MSConnectServer *Server; + +- (void)GetUserImagine; +- (void)GetUserImagineSuccess:(UIImage *)imagine; +- (void)GetUserImagineFail:(NSString *)error; + @end diff --git a/MPSE/User.m b/MPSE/User.m index b0a0fc4..b1e46b7 100644 --- a/MPSE/User.m +++ b/MPSE/User.m @@ -7,3 +7,61 @@ // #import "User.h" +#import "Post.h" + +@implementation MSUserMe + + +@end + +@implementation MSLoginMe + +- (void)doLogin{ + +} + +-(void)ifLoginSuccess:(MSUserMe *)userInfo{ + +} + +-(void)ifLoginFailed:(NSString *)error{ + +} + +@end + +@implementation MSRegisterMe + +- (void)doRegister{ + +} + +-(void)ifRegisterSuccess{ + +} + +@end + +@implementation MSPost + + + +@end + + +@implementation MSAskForImagine + +- (void)GetUserImagine{ + +} + +- (void)GetUserImagineSuccess:(UIImage *)imagine{ + + +} + +-(void)GetUserImagineFail:(NSString *)error{ + +} + +@end diff --git a/MPSE/ViewController.m b/MPSE/ViewController.m index 4a39b19..8f2baa8 100644 --- a/MPSE/ViewController.m +++ b/MPSE/ViewController.m @@ -7,6 +7,7 @@ // #import "ViewController.h" +#import "Post.h" @interface ViewController () @@ -71,13 +72,19 @@ NSString *ShareTextNow = _ShareText.text; NSString *Username = @"Me"; UIImage *UserImagine = [UIImage imageNamed:@"Me.png"]; + MSPost *ThisPost = [[MSPost alloc] init]; + NSString *PostID = [[NSUUID UUID] UUIDString]; + NSString *Time = @"2017-1-1"; - NSUUID *PostID = [[NSUUID alloc] init]; + ThisPost.PostID = PostID; + ThisPost.Text = ShareTextNow; + ThisPost.Username = Username; + ThisPost.Time = Time; - NSArray *SharePost = [[NSArray alloc] initWithObjects:Username,ShareTextNow,UserImagine,nil]; + //NSArray *SharePost = [[NSArray alloc] initWithObjects:Username,ShareTextNow,UserImagine,nil]; - [[NSNotificationCenter defaultCenter] postNotificationName:@"MapAddTarget" object:SharePost]; + [[NSNotificationCenter defaultCenter] postNotificationName:@"MapAddTarget" object:ThisPost]; [[[UIApplication sharedApplication] keyWindow] endEditing:YES]; }