Skip to content

Commit

Permalink
处理MapView
Browse files Browse the repository at this point in the history
  • Loading branch information
changsanjiang committed Jul 20, 2018
1 parent b596a8d commit fede3a5
Show file tree
Hide file tree
Showing 13 changed files with 153 additions and 24 deletions.
Binary file modified SJBackGRProject/.DS_Store
Binary file not shown.
30 changes: 22 additions & 8 deletions SJBackGRProject/SJBackGRProject.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
779177821FC539C100E2AFF7 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 779177811FC539C100E2AFF7 /* README.md */; };
779177851FC53F6D00E2AFF7 /* NavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 779177841FC53F6D00E2AFF7 /* NavigationController.m */; };
77BF683A2016F3DD0040AAC3 /* WebViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 77BF68392016F3DD0040AAC3 /* WebViewController.m */; };
77C426F621017816006C97F6 /* TestMapViewViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 77C426F521017816006C97F6 /* TestMapViewViewController.m */; };
77D9B7681F7E941A00E35746 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 77D9B7671F7E941A00E35746 /* main.m */; };
77D9B76B1F7E941A00E35746 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 77D9B76A1F7E941A00E35746 /* AppDelegate.m */; };
77D9B76E1F7E941A00E35746 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 77D9B76D1F7E941A00E35746 /* ViewController.m */; };
Expand Down Expand Up @@ -86,6 +87,8 @@
77A7162A2012EF1A00278C95 /* SJScreenshotTransitionMode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SJScreenshotTransitionMode.h; sourceTree = "<group>"; };
77BF68382016F3DD0040AAC3 /* WebViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebViewController.h; sourceTree = "<group>"; };
77BF68392016F3DD0040AAC3 /* WebViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = WebViewController.m; sourceTree = "<group>"; };
77C426F421017816006C97F6 /* TestMapViewViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TestMapViewViewController.h; sourceTree = "<group>"; };
77C426F521017816006C97F6 /* TestMapViewViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TestMapViewViewController.m; sourceTree = "<group>"; };
77D9B7631F7E941A00E35746 /* SJBackGRProject.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SJBackGRProject.app; sourceTree = BUILT_PRODUCTS_DIR; };
77D9B7671F7E941A00E35746 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
77D9B7691F7E941A00E35746 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -207,6 +210,15 @@
path = WebTest;
sourceTree = "<group>";
};
77C426F321017803006C97F6 /* TestMapView */ = {
isa = PBXGroup;
children = (
77C426F421017816006C97F6 /* TestMapViewViewController.h */,
77C426F521017816006C97F6 /* TestMapViewViewController.m */,
);
path = TestMapView;
sourceTree = "<group>";
};
77D9B75A1F7E941A00E35746 = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -241,6 +253,7 @@
77D9B76A1F7E941A00E35746 /* AppDelegate.m */,
779177831FC53F6D00E2AFF7 /* NavigationController.h */,
779177841FC53F6D00E2AFF7 /* NavigationController.m */,
77C426F321017803006C97F6 /* TestMapView */,
771FFBB91F7E94B40076EEB0 /* Test */,
7706E1301FF78E8E006E0B56 /* Test2 */,
77BF68372016F3D10040AAC3 /* WebTest */,
Expand Down Expand Up @@ -429,12 +442,12 @@
TargetAttributes = {
77D9B7621F7E941A00E35746 = {
CreatedOnToolsVersion = 8.3.3;
DevelopmentTeam = DB5B5F2RH5;
DevelopmentTeam = U5A7L7SMNP;
ProvisioningStyle = Manual;
};
A6A0A8FC20410F2B003DB0A0 = {
CreatedOnToolsVersion = 9.2;
DevelopmentTeam = DB5B5F2RH5;
DevelopmentTeam = U5A7L7SMNP;
ProvisioningStyle = Manual;
};
A6A0A90F20410F2C003DB0A0 = {
Expand Down Expand Up @@ -633,6 +646,7 @@
771FFBC01F7E94C70076EEB0 /* NoNavViewController.m in Sources */,
77BF683A2016F3DD0040AAC3 /* WebViewController.m in Sources */,
77D9B76E1F7E941A00E35746 /* ViewController.m in Sources */,
77C426F621017816006C97F6 /* TestMapViewViewController.m in Sources */,
770635472025603600A7710F /* UIViewController+TestAdd.m in Sources */,
779177851FC53F6D00E2AFF7 /* NavigationController.m in Sources */,
77D9B7861F7E944100E35746 /* UIViewController+SJVideoPlayerAdd.m in Sources */,
Expand Down Expand Up @@ -835,14 +849,14 @@
baseConfigurationReference = 39202E5F7055D8AC447FC6B4 /* Pods-SJBackGRProject.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = DB5B5F2RH5;
DEVELOPMENT_TEAM = U5A7L7SMNP;
INFOPLIST_FILE = SJBackGRProject/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.SanJiang.SJBackGRProject;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "64c214b3-450d-41eb-b05e-df636dfa28c8";
PROVISIONING_PROFILE_SPECIFIER = SanJiangDevelopment;
PROVISIONING_PROFILE = "02be20ab-2aab-4a89-9d96-15e5d369996e";
PROVISIONING_PROFILE_SPECIFIER = WildcardProfile;
};
name = Debug;
};
Expand Down Expand Up @@ -870,15 +884,15 @@
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = DB5B5F2RH5;
DEVELOPMENT_TEAM = U5A7L7SMNP;
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = SwiftVersion/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.sanjiang.ddd;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "acd2453e-e396-4ccf-bf56-508276824c6c";
PROVISIONING_PROFILE_SPECIFIER = SanJiangDevelopment;
PROVISIONING_PROFILE = "02be20ab-2aab-4a89-9d96-15e5d369996e";
PROVISIONING_PROFILE_SPECIFIER = WildcardProfile;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
Expand Down
Binary file not shown.
13 changes: 11 additions & 2 deletions SJBackGRProject/SJBackGRProject/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="LjD-BP-vdg">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="LjD-BP-vdg">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand Down Expand Up @@ -36,9 +36,18 @@
<action selector="webClicked:" destination="BYZ-38-t0r" eventType="touchUpInside" id="pL3-vU-KUb"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="x35-qR-7OW">
<rect key="frame" x="156" y="570" width="63" height="30"/>
<state key="normal" title="MapView"/>
<connections>
<action selector="testMap:" destination="BYZ-38-t0r" eventType="touchUpInside" id="8MV-sD-hTk"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="x35-qR-7OW" firstAttribute="top" secondItem="3ql-wO-ZWR" secondAttribute="bottom" constant="17" id="97l-mn-ev8"/>
<constraint firstItem="x35-qR-7OW" firstAttribute="centerX" secondItem="3ql-wO-ZWR" secondAttribute="centerX" id="NmP-a7-tVS"/>
<constraint firstItem="3ql-wO-ZWR" firstAttribute="top" secondItem="AEb-Os-sMu" secondAttribute="bottom" constant="7.5" id="PmZ-PJ-WBC"/>
<constraint firstItem="3ql-wO-ZWR" firstAttribute="centerX" secondItem="AEb-Os-sMu" secondAttribute="centerX" id="Wsb-OE-9jU"/>
<constraint firstItem="AEb-Os-sMu" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="h68-DD-sL9"/>
Expand Down
12 changes: 7 additions & 5 deletions SJBackGRProject/SJBackGRProject/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string>TTTT</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion SJBackGRProject/SJBackGRProject/NavigationController.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ - (void)viewDidLoad {
[super viewDidLoad];
self.sj_backgroundColor = [UIColor whiteColor];
self.sj_transitionMode = SJScreenshotTransitionModeShifting;
self.sj_gestureType = SJFullscreenPopGestureType_Full;
// self.sj_gestureType = SJFullscreenPopGestureType_Full;

// Do any additional setup after loading the view.
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// TestMapViewViewController.h
// SJBackGRProject
//
// Created by BlueDancer on 2018/7/20.
// Copyright © 2018年 SanJiang. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface TestMapViewViewController : UIViewController

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
//
// TestMapViewViewController.m
// SJBackGRProject
//
// Created by BlueDancer on 2018/7/20.
// Copyright © 2018年 SanJiang. All rights reserved.
//

#import "TestMapViewViewController.h"
#import <MapKit/MapKit.h>
#import <Masonry.h>

#import "UINavigationController+SJVideoPlayerAdd.h"
#import "UIViewController+SJVideoPlayerAdd.h"

@interface TestMapViewViewController ()
@property (nonatomic, strong) MKMapView *mapView;
@property (nonatomic, strong) UIButton *button;
@end

@implementation TestMapViewViewController

- (void)viewDidLoad {
[super viewDidLoad];

self.view.backgroundColor = [UIColor whiteColor];

_mapView = [[MKMapView alloc] initWithFrame:self.view.bounds];
[self.view addSubview:_mapView];
[_mapView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.offset(0);
}];


_button = [[UIButton alloc] initWithFrame:CGRectZero];
[_button setTitle:@"切换手势" forState:UIControlStateNormal];
_button.backgroundColor = [UIColor blackColor];
[_button addTarget:self action:@selector(switchGestureType:) forControlEvents:UIControlEventTouchUpInside];

[self.view addSubview:_button];
[_button mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.offset(0);
}];


self.sj_fadeArea = @[[NSValue valueWithCGRect:(CGRect){CGPointMake(100, 0), self.view.frame.size}]];

// Do any additional setup after loading the view.
}

- (void)switchGestureType:(UIButton *)btn {
switch ( self.navigationController.sj_gestureType ) {
case SJFullscreenPopGestureType_Full: {
self.navigationController.sj_gestureType = SJFullscreenPopGestureType_EdgeLeft;
[btn setTitle:@"SJFullscreenPopGestureType_EdgeLeft" forState:UIControlStateNormal];
}
break;
case SJFullscreenPopGestureType_EdgeLeft: {
self.navigationController.sj_gestureType = SJFullscreenPopGestureType_Full;
[btn setTitle:@"SJFullscreenPopGestureType_Full" forState:UIControlStateNormal];
}
break;
}
}

@end
4 changes: 4 additions & 0 deletions SJBackGRProject/SJBackGRProject/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#import <SJTransitionAnimator.h>
#import "SJTest2ViewController.h"
#import "WebViewController.h"
#import "TestMapViewViewController.h"

@interface ViewController ()

Expand Down Expand Up @@ -75,4 +76,7 @@ - (IBAction)webClicked:(id)sender {
[self.navigationController pushViewController:vc animated:YES];
}

- (IBAction)testMap:(id)sender {
[self.navigationController pushViewController:[TestMapViewViewController new] animated:YES];
}
@end
2 changes: 1 addition & 1 deletion SJFullscreenPopGesture.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Pod::Spec.new do |s|

s.name = "SJFullscreenPopGesture"
s.version = "1.4.3"
s.version = "1.4.4"
s.summary = "fullscreen pop gestures."
s.description = 'fullscreen pop gesture. System native gestures and custom gestures are free to switch.'

Expand Down
14 changes: 12 additions & 2 deletions SJFullscreenPopGesture/UINavigationController+SJVideoPlayerAdd.m
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,19 @@ - (BOOL)gestureRecognizerShouldBegin:(UIPanGestureRecognizer *)gestureRecognizer

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
if ( UIGestureRecognizerStateFailed == gestureRecognizer.state ||
UIGestureRecognizerStateCancelled == gestureRecognizer.state ) return NO;
UIGestureRecognizerStateCancelled == gestureRecognizer.state ) return NO;

else if ( ([otherGestureRecognizer isMemberOfClass:NSClassFromString(@"UIScrollViewPanGestureRecognizer")] ||
if ( gestureRecognizer == [self SJ_edgePan] ) {
[self _sjCancellGesture:otherGestureRecognizer];
return YES;
}

if ( ![self SJ_isFadeAreaWithPoint:[gestureRecognizer locationInView:gestureRecognizer.view]] ) {
[self _sjCancellGesture:otherGestureRecognizer];
return YES;
}

if ( ([otherGestureRecognizer isMemberOfClass:NSClassFromString(@"UIScrollViewPanGestureRecognizer")] ||
[otherGestureRecognizer isMemberOfClass:NSClassFromString(@"UIScrollViewPagingSwipeGestureRecognizer")])
&& [otherGestureRecognizer.view isKindOfClass:[UIScrollView class]] ) {
return [self SJ_considerScrollView:(UIScrollView *)otherGestureRecognizer.view
Expand Down
2 changes: 1 addition & 1 deletion SJNavigationPopGesture.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Pod::Spec.new do |s|
#

s.name = "SJNavigationPopGesture"
s.version = "1.4.3"
s.version = "1.4.4"
s.summary = "fullscreen pop gestures."

# This description is used to generate tags and improve search results.
Expand Down
19 changes: 15 additions & 4 deletions SJNavigationPopGesture/SJNavigationPopGesture.swift
Original file line number Diff line number Diff line change
Expand Up @@ -417,10 +417,21 @@ extension UINavigationController : UIGestureRecognizerDelegate {
if ( gestureRecognizer.state == UIGestureRecognizerState.failed ||
gestureRecognizer.state == UIGestureRecognizerState.cancelled ) {
return false
}
else if ( otherGestureRecognizer.isMember(of: NSClassFromString("UIScrollViewPanGestureRecognizer")!) == true ||
otherGestureRecognizer.isMember(of: NSClassFromString("UIScrollViewPagingSwipeGestureRecognizer")!) == true
&& otherGestureRecognizer.isKind(of: UIScrollView.self) == true ) {
}

if ( gestureRecognizer == SJ_edgePan ) {
SJ_cancellGesture(otherGestureRecognizer)
return true
}

if ( !SJ_isFadeArea(gestureRecognizer.location(in: gestureRecognizer.view)) ) {
SJ_cancellGesture(otherGestureRecognizer)
return true
}

if ( otherGestureRecognizer.isMember(of: NSClassFromString("UIScrollViewPanGestureRecognizer")!) == true ||
otherGestureRecognizer.isMember(of: NSClassFromString("UIScrollViewPagingSwipeGestureRecognizer")!) == true
&& otherGestureRecognizer.isKind(of: UIScrollView.self) == true ) {
let scrollView = otherGestureRecognizer.view as! UIScrollView
let panGesture = gestureRecognizer as! UIPanGestureRecognizer
return SJ_considerScrollView(scrollView, panGesture, otherGestureRecognizer)
Expand Down

0 comments on commit fede3a5

Please sign in to comment.