no message
This commit is contained in:
1 parent
6c0f2bbae5
commit
4d7c6109a6
32 files changed
+1487
-1002
No files matched your search
@@ -18,6 +18,7 @@
|
||||
|
||||
if (self) {
|
||||
self.backgroundColor = [UIColor whiteColor];
|
||||
[self setUserInteractionEnabled:YES];
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -291,6 +292,7 @@
|
||||
|
||||
- (void)addSubview:(UIView *)view {
|
||||
[super addSubview:view];
|
||||
[view setUserInteractionEnabled:YES];
|
||||
|
||||
int currentLowestPoint = [self CGRectOrigin:_bottomComponent] + [self CGRectSize:_bottomComponent];
|
||||
int viewLowestPoint = [self frameOrigin:view] + [self frameSize:view];
|
||||
@@ -318,4 +320,25 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void) touchesEnded: (NSSet *) touches withEvent: (UIEvent *) event
|
||||
{
|
||||
// If not dragging, send event to next responder
|
||||
if (!self.dragging) {
|
||||
[self.nextResponder.nextResponder touchesEnded: touches withEvent:event];
|
||||
}
|
||||
else
|
||||
[super touchesEnded: touches withEvent: event];
|
||||
|
||||
}
|
||||
|
||||
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||
|
||||
if (!self.dragging) {
|
||||
[self.nextResponder.nextResponder touchesBegan: touches withEvent:event];
|
||||
}
|
||||
else
|
||||
[super touchesBegan: touches withEvent:event];
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// SharedLocationManager.h
|
||||
// Pods
|
||||
//
|
||||
// Created by Giuseppe Nucifora on 15/07/15.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
|
||||
@interface SharedLocationManager : NSObject <CLLocationManagerDelegate>{
|
||||
CLLocationManager *locationManager;
|
||||
CLLocation *currentLocation;
|
||||
}
|
||||
|
||||
+ (id) sharedManager;
|
||||
- (void) setCurrentLocation;
|
||||
- (CLLocation*) getCurrentLocation;
|
||||
- (BOOL) locationIsSet;
|
||||
- (BOOL) localizationIsAuthorized;
|
||||
- (CLAuthorizationStatus) localizationAuthorizationStatus;
|
||||
|
||||
@end
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
//
|
||||
// SharedLocationManager.m
|
||||
// Pods
|
||||
//
|
||||
// Created by Giuseppe Nucifora on 15/07/15.
|
||||
//
|
||||
|
||||
#import "SharedLocationManager.h"
|
||||
|
||||
@implementation SharedLocationManager
|
||||
+ (id)sharedManager {
|
||||
static SharedLocationManager *sharedMyManager = nil;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
sharedMyManager = [[self alloc] init];
|
||||
});
|
||||
return sharedMyManager;
|
||||
}
|
||||
|
||||
- (id)init {
|
||||
if (self = [super init]) {
|
||||
locationManager = [[CLLocationManager alloc] init];
|
||||
locationManager.delegate = self;
|
||||
locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters;
|
||||
if([[[UIDevice currentDevice] systemVersion] floatValue] < 8.0)
|
||||
{
|
||||
[CLLocationManager authorizationStatus];
|
||||
}
|
||||
else {
|
||||
[locationManager requestWhenInUseAuthorization];
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
- (void)setCurrentLocation {
|
||||
|
||||
[locationManager startUpdatingLocation];
|
||||
}
|
||||
#pragma mark - CLLocationManagerDelegate
|
||||
|
||||
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
|
||||
{
|
||||
[locationManager stopUpdatingLocation];
|
||||
}
|
||||
|
||||
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
|
||||
{
|
||||
if (newLocation != nil) {
|
||||
currentLocation = newLocation;
|
||||
}
|
||||
[locationManager stopUpdatingLocation];
|
||||
}
|
||||
|
||||
-(BOOL)locationIsSet {
|
||||
if(currentLocation != nil)
|
||||
return YES;
|
||||
else
|
||||
return NO;
|
||||
}
|
||||
|
||||
-(CLLocation*)getCurrentLocation {
|
||||
return currentLocation;
|
||||
}
|
||||
|
||||
- (BOOL) localizationIsAuthorized {
|
||||
if ( [CLLocationManager locationServicesEnabled] == NO || [self localizationAuthorizationStatus] == kCLAuthorizationStatusDenied)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (CLAuthorizationStatus) localizationAuthorizationStatus {
|
||||
return [CLLocationManager authorizationStatus];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// ToucheableScrollView.m
|
||||
//
|
||||
//
|
||||
// Created by Mario Nolassi on 11/16/11.
|
||||
// Copyright (c) 2011 meedori. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface ToucheableScrollView : UIScrollView
|
||||
|
||||
@end
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// ToucheableScrollView.m
|
||||
//
|
||||
//
|
||||
// Created by Mario Nolassi on 11/16/11.
|
||||
// Copyright (c) 2011 meedori. All rights reserved.
|
||||
//
|
||||
|
||||
#import "ToucheableScrollView.h"
|
||||
|
||||
@implementation ToucheableScrollView
|
||||
|
||||
- (id)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
|
||||
if (self) {
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
- (void) touchesEnded: (NSSet *) touches withEvent: (UIEvent *) event
|
||||
{
|
||||
// If not dragging, send event to next responder
|
||||
if (!self.dragging) {
|
||||
if ([self.nextResponder respondsToSelector:@selector(touchesEnded:withEvent:)]) {
|
||||
[self.nextResponder touchesEnded: touches withEvent:event];
|
||||
}
|
||||
if ([self.nextResponder.nextResponder respondsToSelector:@selector(touchesEnded:withEvent:)]) {
|
||||
[self.nextResponder.nextResponder touchesEnded: touches withEvent:event];
|
||||
}
|
||||
if ([self.nextResponder.nextResponder.nextResponder respondsToSelector:@selector(touchesEnded:withEvent:)]) {
|
||||
[self.nextResponder.nextResponder.nextResponder touchesEnded: touches withEvent:event];
|
||||
}
|
||||
}
|
||||
else {
|
||||
[super touchesEnded: touches withEvent: event];
|
||||
}
|
||||
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user