Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Changed Mapkit

  • Loading branch information...
commit a0491a7d843a1c8b02c2996ddf4e10a6b2102a25 1 parent 33bcc43
@prasadmb prasadmb authored
View
47 Ginza/Ginza/MapKit/MapView.m
@@ -31,8 +31,7 @@ - (id) initWithFrame:(CGRect) frame
routeView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 40, mapView.frame.size.width, mapView.frame.size.height)];
routeView.userInteractionEnabled = NO;
[mapView addSubview:routeView];
-
- self.lineColor = [UIColor blueColor];
+ self.lineColor = [UIColor colorWithRed:0.0 green:0.5 blue:1 alpha:0.6];
}
return self;
}
@@ -151,7 +150,7 @@ -(void) updateRouteView {
CGContextSetStrokeColorWithColor(context, lineColor.CGColor);
CGContextSetRGBFillColor(context, 0.0, 0.0, 1.0, 1.0);
- CGContextSetLineWidth(context, 3.0);
+ CGContextSetLineWidth(context, 10.0);
for(int i = 0; i < routes.count; i++) {
CLLocation* location = [routes objectAtIndex:i];
@@ -187,6 +186,48 @@ - (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated
[routeView setNeedsDisplay];
}
+-(MKAnnotationView *)mapView:(MKMapView *)mV viewForAnnotation:
+(id <MKAnnotation>)annotation {
+
+ BOOL isGreen = YES;
+ //if([annotation isKindOfClass:[MKAnnotation class]])
+ // isGreen = NO;
+
+ MKPinAnnotationView *pinView = nil;
+ PlaceMark *pMark=annotation;
+ if([pMark.place.name isEqualToString:@"Current Location"])
+ isGreen=NO;
+ NSLog(@"Current Location:%@",annotation);
+ if (isGreen) {
+ static NSString *greenPin = @"greenPin";
+ pinView = (MKPinAnnotationView *) [mapView dequeueReusableAnnotationViewWithIdentifier:greenPin];
+ if (!pinView) {
+ pinView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:greenPin] autorelease];
+ pinView.pinColor = MKPinAnnotationColorGreen;
+ pinView.animatesDrop = NO;
+ pinView.canShowCallout = YES;
+ }
+ else
+ pinView.annotation = annotation;
+
+ }
+ else {
+ static NSString *purplePin = @"purplePin";
+ pinView = (MKPinAnnotationView *) [mapView dequeueReusableAnnotationViewWithIdentifier:purplePin];
+ if (!pinView) {
+ pinView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:purplePin] autorelease];
+ pinView.pinColor = MKPinAnnotationColorRed;
+ pinView.animatesDrop = NO;
+ pinView.canShowCallout = YES;
+ }
+ else
+ pinView.annotation = annotation;
+ }
+
+
+ return pinView;
+}
+
- (void)dealloc {
if(routes) {
[routes release];
View
4 Ginza/Ginza/MapKit/MapWithRoutesViewController.h
@@ -13,9 +13,11 @@
@interface MapWithRoutesViewController : UIViewController {
CLLocation *destination;
+ NSString *destinationAddress;
}
-@property(nonatomic,retain) CLLocation *destination;
+@property(nonatomic,retain) CLLocation *destination;
+@property(nonatomic,retain) NSString *destinationAddress;
- (void) setDestination:(CLLocation *) aDestination;
- (void)cancel:(id)sender;
- (void) createTopBar;
View
19 Ginza/Ginza/MapKit/MapWithRoutesViewController.m
@@ -11,7 +11,7 @@
@implementation MapWithRoutesViewController
@synthesize destination;
-
+@synthesize destinationAddress;
/*
// The designated initializer. Override to perform setup that is required before the view is loaded.
@@ -45,13 +45,13 @@ - (void)viewDidLoad {
source.name = @"Current Location";
source.description = @"";
//Ginza Latitirude & Longitude
- //source.latitude = 35.6707504;
- //source.longitude = 139.769467;
- source.latitude=currentLoc.coordinate.latitude;
- source.longitude=currentLoc.coordinate.longitude;
+ source.latitude = 35.6707504;
+ source.longitude = 139.769467;
+ //source.latitude=currentLoc.coordinate.latitude;
+ //source.longitude=currentLoc.coordinate.longitude;
Place* dest = [[[Place alloc] init] autorelease];
- dest.name = @"Destination";
- dest.description = @"Destination";
+ dest.name =destinationAddress;
+ //dest.description = @"Destination";
//dest.latitude = 1.3296047;
//dest.longitude = 103.8932174;
dest.latitude= self.destination.coordinate.latitude;
@@ -79,9 +79,10 @@ - (void) createTopBar {
}
- (void) setDestination:(CLLocation *) aDestination {
destination=aDestination;
- NSLog(@"Destinat");
}
-
+- (void) setDestinationAddress:(NSString *) aDestinationAddress {
+ destinationAddress=aDestinationAddress;
+}
- (void)cancel:(id)sender {
[self dismissModalViewControllerAnimated:YES];
}
View
4 Ginza/Ginza/View Controllers/ListViewController.m
@@ -279,7 +279,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
int time = (me/4000)*15;
cell.lblDistance.text =[NSString stringWithFormat:@" %.fm (徒歩%d分)",meters,time];
// Animate Arrow
- double radians=((([self bearingToLocation:storeLocation])- mHeading)*M_PI)/360;
+ double radians=((([self bearingToLocation:storeLocation])- mHeading)*M_PI)/180;
CABasicAnimation *theAnimation;
theAnimation=[CABasicAnimation animationWithKeyPath:@"transform.rotation"];
theAnimation.duration = 0.5f;
@@ -308,7 +308,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
int time = (me/4000)*15;
cell.lblDistance.text =[NSString stringWithFormat:@" %.fm (徒歩%d分)",meters,time];
// Animate Arrow
- double radians=((([self bearingToLocation:storeLocation])- mHeading)*M_PI)/360;
+ double radians=((([self bearingToLocation:storeLocation])- mHeading)*M_PI)/180;
CABasicAnimation *theAnimation;
theAnimation=[CABasicAnimation animationWithKeyPath:@"transform.rotation"];
theAnimation.duration = 0.5f;
View
3  Ginza/Ginza/View Controllers/OfferDetailsViewController.h
@@ -18,6 +18,7 @@
//Added by MobiQuest team
float mHeading;
+ float mWebViewFlexibleHeight;
CLHeading *newHeadingObject;
NSString *currenDirection;
NSString *previousDirection;
@@ -71,4 +72,6 @@
- (void) sendEmail;
-(NSString *) shareKitMessage;
-(void) animateArrowImage;
+- (void)setUILabel:(UILabel *)myLabel withMaxFrame:(CGRect)maxFrame withText:(NSString *)theText usingVerticalAlign:(int)vertAlign;
+- (void) loadWebView;
@end
View
84 Ginza/Ginza/View Controllers/OfferDetailsViewController.m
@@ -79,22 +79,20 @@ - (void)viewDidLoad
[locationManager startUpdatingHeading];
AppDelegate *appDeligate = (AppDelegate *)[[UIApplication sharedApplication]delegate];
-
self.offer = [appDeligate getOfferDataById:self.offerId];
NSLog(@"Title:%@",self.offer.offer_title);
NSLog(@"Category:%@",self.offer.category);
NSLog(@"Lead Text:%@",offer.lead_text);
NSLog(@"Copy Text:%@",offer.copy_text);
-
NSLog(@"DetailView Offer:%@",self.offerId);
lblCategoryName.text = self.offer.category;
lblOfferTitle.text=self.offer.offer_title;
- scroll.contentSize = CGSizeMake(320, 1045);
+ scroll.contentSize = CGSizeMake(320, 670);
+ [[self.webFreeText.subviews objectAtIndex:0] setScrollEnabled:NO];
self.webFreeText.backgroundColor =[UIColor clearColor];
[self.webFreeText setOpaque:NO];
- NSString *weViewData =[NSString stringWithFormat:@"<HTML><body style=\"background-color:transparent\"><table><tr><td>%@<hr></td></tr><tr><td>%@</td></tr><tr><td>%@</td></tr></table></HTML>",offer.lead_text,offer.copy_text,offer.free_text];
- [self.webFreeText loadHTMLString:weViewData baseURL:nil];
-
+ [self loadWebView];
+ [self.webFreeText setDelegate:self];
ShopList *merchant = [appDeligate getStoreDataById:offer.store_id];
Categories *categoryData = (Categories *)[appDeligate getCategoryDataById:merchant.sub_category];
@@ -172,20 +170,11 @@ - (void)viewDidLoad
double Latitude = [merchant.latitude doubleValue];
double Longitude = [merchant.longitude doubleValue];
-
-
-
self.storeLocation = [[CLLocation alloc]initWithLatitude:Latitude longitude:Longitude];
-
-
CLLocationDistance meters = [self.currentLocation distanceFromLocation:self.storeLocation];
- //4000 mtr = 15 min
- //NSLog(@"meters %d",meters);
double me =[[NSString stringWithFormat:@"%.f",meters] doubleValue];
int time = (me/4000)*15;
self.lblDistanceLabel.text =[NSString stringWithFormat:@" %.fm (徒歩%d分)",meters,time];
-
-
if (merchant.is_child == 0) {
lblIsChild.hidden = YES;
@@ -205,7 +194,16 @@ -(void)viewWillAppear:(BOOL)animated
{
}
+- (void)webViewDidFinishLoad:(UIWebView *)webView
+{
+ mWebViewFlexibleHeight=[[webView stringByEvaluatingJavaScriptFromString:@"document.body.offsetHeight;"] floatValue];
+
+}
+- (void) loadWebView {
+ NSString *weViewData =[NSString stringWithFormat:@"<HTML><body style=\"background-color:transparent\"><table><tr><td>%@<hr></td></tr><tr><td>%@</td></tr><tr><td>%@</td></tr></table></HTML>",offer.lead_text,offer.copy_text,offer.free_text];
+ [self.webFreeText loadHTMLString:weViewData baseURL:nil];
+}
- (void)viewDidUnload
{
[super viewDidUnload];
@@ -216,6 +214,7 @@ - (void)viewDidUnload
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
+ [self loadWebView];
return YES;
}
-(IBAction)btnOfferDetailsOpenClose:(id)sender
@@ -223,8 +222,10 @@ -(IBAction)btnOfferDetailsOpenClose:(id)sender
UIButton *btn = sender;
if(btn.tag ==0)
{
+ NSLog(@"WebviewHeifgt%lf",self.webFreeText.frame.size.height);
CGRect rec = self.viewOfferDetails.frame;
- rec.size.height = 500;
+ rec.size.height = mWebViewFlexibleHeight+50;
+ scroll.contentSize = CGSizeMake(320, scroll.contentSize.height+mWebViewFlexibleHeight-50);
self.viewOfferDetails.frame = rec;
[self.scroll scrollRectToVisible:self.viewOfferDetails.frame animated:YES];
CGRect rec1 = self.bottomView.frame;
@@ -236,12 +237,12 @@ -(IBAction)btnOfferDetailsOpenClose:(id)sender
{
CGRect rec = self.viewOfferDetails.frame;
rec.size.height = 115;
+ scroll.contentSize = CGSizeMake(320, 670);
self.viewOfferDetails.frame = rec;
[self.scroll scrollRectToVisible:self.viewOfferDetails.frame animated:YES];
CGRect rec1 = self.bottomView.frame;
rec1.origin.y = rec.origin.y + rec.size.height+20;
self.bottomView.frame = rec1;
-
btn.tag=0;
[self.arrowImage setImage:[UIImage imageNamed:@"Arrowwhite.png"]];
}
@@ -298,8 +299,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView1 cellForRowAtIndexPath:(
[cell addSubview:lblAddress];
UILabel *lblAddressdetails = [[UILabel alloc]init];
- lblAddressdetails.frame = CGRectMake(150,0,150, 40);
- lblAddressdetails.textAlignment = UITextAlignmentCenter;
+ lblAddressdetails.frame = CGRectMake(160,0,150, 50);
+ lblAddressdetails.textAlignment = UITextAlignmentLeft;
lblAddressdetails.lineBreakMode = UILineBreakModeWordWrap;
lblAddressdetails.numberOfLines = 3;
@@ -307,7 +308,6 @@ - (UITableViewCell *)tableView:(UITableView *)tableView1 cellForRowAtIndexPath:(
lblAddressdetails.backgroundColor = [UIColor clearColor];
lblAddressdetails.textColor = [UIColor blackColor];
lblAddressdetails.text = merchant.address;
-
[cell addSubview:lblAddressdetails];
@@ -319,10 +319,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView1 cellForRowAtIndexPath:(
UILabel *lblphone = [[UILabel alloc]init];
lblphone.frame = CGRectMake(0,0,150, 40);
lblphone.textAlignment = UITextAlignmentLeft;
-
-
lblphone.font = [UIFont systemFontOfSize:12];
-
lblphone.backgroundColor = [UIColor clearColor];
lblphone.textColor = [UIColor blackColor];
lblphone.text = @"電話番号";
@@ -330,8 +327,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView1 cellForRowAtIndexPath:(
[cell addSubview:lblphone];
UILabel *lblphonedetails = [[UILabel alloc]init];
- lblphonedetails.frame = CGRectMake(150,0,150, 40);
- lblphonedetails.textAlignment = UITextAlignmentCenter;
+ lblphonedetails.frame = CGRectMake(160,0,150, 50);
+ lblphonedetails.textAlignment = UITextAlignmentLeft;
lblphonedetails.lineBreakMode = UILineBreakModeWordWrap;
lblphonedetails.numberOfLines = 3;
@@ -339,33 +336,28 @@ - (UITableViewCell *)tableView:(UITableView *)tableView1 cellForRowAtIndexPath:(
lblphonedetails.backgroundColor = [UIColor clearColor];
lblphonedetails.textColor = [UIColor blackColor];
lblphonedetails.text = merchant.phone;
-
[cell addSubview:lblphonedetails];
-
-
-
+ UIButton * btnPhoneNumber= [UIButton buttonWithType:UIButtonTypeCustom];
+ [btnPhoneNumber addTarget:self action:@selector(clickPhoneNumber:) forControlEvents:UIControlEventTouchUpInside];
+ btnPhoneNumber.frame=CGRectMake(160,0,150, 50);
+ [cell addSubview:btnPhoneNumber];
}
if (indexPath.row==2) {
-
-
+
UILabel *lbltime = [[UILabel alloc]init];
lbltime.frame = CGRectMake(0,0,150, 40);
lbltime.textAlignment = UITextAlignmentLeft;
-
-
lbltime.font = [UIFont systemFontOfSize:12];
-
lbltime.backgroundColor = [UIColor clearColor];
lbltime.textColor = [UIColor blackColor];
lbltime.text = @"営業時間";
-
[cell addSubview:lbltime];
UILabel *lbltimedetails = [[UILabel alloc]init];
- lbltimedetails.frame = CGRectMake(150,0,150, 40);
- lbltimedetails.textAlignment = UITextAlignmentCenter;
+ lbltimedetails.frame = CGRectMake(160,0,150, 50);
+ lbltimedetails.textAlignment = UITextAlignmentLeft;
lbltimedetails.lineBreakMode = UILineBreakModeWordWrap;
lbltimedetails.numberOfLines = 3;
@@ -397,8 +389,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView1 cellForRowAtIndexPath:(
[cell addSubview:lblholiday];
UILabel *lblholidaydetails = [[UILabel alloc]init];
- lblholidaydetails.frame = CGRectMake(150,0,150, 40);
- lblholidaydetails.textAlignment = UITextAlignmentCenter;
+ lblholidaydetails.frame = CGRectMake(160,0,150, 50);
+ lblholidaydetails.textAlignment = UITextAlignmentLeft;
lblholidaydetails.lineBreakMode = UILineBreakModeWordWrap;
lblholidaydetails.numberOfLines = 3;
@@ -431,7 +423,6 @@ - (void)locationManager:(CLLocationManager *)manager
{
self.currentLocation=newLocation;
-
CLLocationDistance meters = [self.currentLocation distanceFromLocation:self.storeLocation];
//4000 mtr = 15 min
//NSLog(@"meters %d",meters);
@@ -528,8 +519,10 @@ -(IBAction)btnBookmark:(id)sender
- (IBAction)getDirectionButtonPressed:(id)sender {
MapWithRoutesViewController *directionVC=[[MapWithRoutesViewController alloc] initWithNibName:@"MapWithRoutesViewController" bundle:nil];
- //directionVC setLat:lat setLong:lon];
- directionVC.destination=self.storeLocation;
+ AppDelegate *appDeligate =(AppDelegate *) [[UIApplication sharedApplication]delegate];
+ ShopList *merchant = [appDeligate getStoreDataById:self.offer.store_id];
+ directionVC.destination=self.storeLocation;
+ directionVC.destinationAddress=merchant.address;
[self presentModalViewController:directionVC animated:YES];
}
@@ -587,4 +580,11 @@ -(NSString *)shareKitMessage {
return strMessage;
}
+- (void)clickPhoneNumber:(id) sender {
+ AppDelegate *appDeligate =(AppDelegate *) [[UIApplication sharedApplication]delegate];
+ ShopList *merchant = [appDeligate getStoreDataById:offer.store_id];
+ NSString *phoneNumber = [@"tel://" stringByAppendingString:merchant.phone];
+ [[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]];
+}
+
@end
View
16 Ginza/Ginza/Views/OfferDetailsViewController.xib
@@ -193,7 +193,7 @@
<object class="IBUIImageView" id="1004932813">
<reference key="NSNextResponder" ref="952007509"/>
<int key="NSvFlags">293</int>
- <string key="NSFrame">{{96, 257}, {27, 29}}</string>
+ <string key="NSFrame">{{104, 257}, {27, 29}}</string>
<reference key="NSSuperview" ref="952007509"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="137951918"/>
@@ -207,7 +207,7 @@
</object>
<object class="IBUILabel" id="137951918">
<reference key="NSNextResponder" ref="952007509"/>
- <int key="NSvFlags">293</int>
+ <int key="NSvFlags">295</int>
<string key="NSFrame">{{126, 260}, {174, 21}}</string>
<reference key="NSSuperview" ref="952007509"/>
<reference key="NSWindow"/>
@@ -358,7 +358,7 @@
</object>
<object class="IBUILabel" id="1071278941">
<reference key="NSNextResponder" ref="1046644756"/>
- <int key="NSvFlags">269</int>
+ <int key="NSvFlags">303</int>
<string key="NSFrame">{{41, 207}, {60, 15}}</string>
<reference key="NSSuperview" ref="1046644756"/>
<reference key="NSWindow"/>
@@ -399,7 +399,7 @@
</object>
<object class="IBUILabel" id="900048556">
<reference key="NSNextResponder" ref="1046644756"/>
- <int key="NSvFlags">269</int>
+ <int key="NSvFlags">303</int>
<string key="NSFrame">{{140, 204}, {85, 21}}</string>
<reference key="NSSuperview" ref="1046644756"/>
<reference key="NSWindow"/>
@@ -433,7 +433,7 @@
</object>
<object class="IBUILabel" id="134858286">
<reference key="NSNextResponder" ref="1046644756"/>
- <int key="NSvFlags">297</int>
+ <int key="NSvFlags">303</int>
<string key="NSFrame">{{243, 207}, {48, 15}}</string>
<reference key="NSSuperview" ref="1046644756"/>
<reference key="NSWindow"/>
@@ -521,7 +521,7 @@
</object>
<object class="IBUIButton" id="367749849">
<reference key="NSNextResponder" ref="191373211"/>
- <int key="NSvFlags">292</int>
+ <int key="NSvFlags">291</int>
<string key="NSFrame">{{269, 64}, {36, 37}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
@@ -903,11 +903,11 @@
<array class="NSMutableArray" key="children">
<reference ref="134858286"/>
<reference ref="46735270"/>
- <reference ref="900048556"/>
<reference ref="235130741"/>
- <reference ref="1071278941"/>
<reference ref="712461921"/>
<reference ref="186445374"/>
+ <reference ref="900048556"/>
+ <reference ref="1071278941"/>
</array>
<reference key="parent" ref="952007509"/>
</object>
Please sign in to comment.
Something went wrong with that request. Please try again.