Skip to content
This repository was archived by the owner on Oct 14, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
3 changes: 2 additions & 1 deletion Classes/MMPopupView.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#import "MMPopupCategory.h"
#import "MMPopupDefine.h"


typedef NS_ENUM(NSUInteger, MMPopupType) {
MMPopupTypeAlert,
MMPopupTypeSheet,
Expand All @@ -23,7 +24,7 @@ typedef NS_ENUM(NSUInteger, MMPopupType) {
typedef void(^MMPopupBlock)(MMPopupView *);
typedef void(^MMPopupCompletionBlock)(MMPopupView *, BOOL);

@interface MMPopupView : UIView
@interface MMPopupView : UIView<MMPopupWindowWildToHideProtocol>

@property (nonatomic, assign, readonly) BOOL visible; // default is NO.

Expand Down
30 changes: 23 additions & 7 deletions Classes/MMPopupView.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

static NSString * const MMPopupViewHideAllNotification = @"MMPopupViewHideAllNotification";


@implementation MMPopupView

- (instancetype)initWithFrame:(CGRect)frame
Expand All @@ -35,11 +36,14 @@ - (void)setup
self.attachedView = [MMPopupWindow sharedWindow].attachView;

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(notifyHideAll:) name:MMPopupViewHideAllNotification object:nil];

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(notifyTouchWildToHide:) name:MMPopupWindowWildToHideNotification object:self];
}

- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self name:MMPopupViewHideAllNotification object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:MMPopupWindowWildToHideNotification object:self];
}

- (void)notifyHideAll:(NSNotification*)n
Expand All @@ -50,6 +54,18 @@ - (void)notifyHideAll:(NSNotification*)n
}
}

- (void)notifyTouchWildToHide:(NSNotification*)n{

if ([self isEqual:n.object]) {

if ([self respondsToSelector:@selector(touchwildToHideHandler)]) {

[self touchwildToHideHandler];
}
}

}

+ (void)hideAll
{
[[NSNotificationCenter defaultCenter] postNotificationName:MMPopupViewHideAllNotification object:[self class]];
Expand Down Expand Up @@ -174,7 +190,7 @@ - (MMPopupBlock)alertShowAnimation
[self mas_updateConstraints:^(MASConstraintMaker *make) {
make.center.equalTo(self.attachedView).centerOffset(CGPointMake(0, self.withKeyboard?-216/2:0));
}];
[self layoutIfNeeded];
[self.superview layoutIfNeeded];
}

self.layer.transform = CATransform3DMakeScale(1.2f, 1.2f, 1.0f);
Expand Down Expand Up @@ -245,7 +261,7 @@ - (MMPopupBlock)sheetShowAnimation
make.centerX.equalTo(self.attachedView);
make.bottom.equalTo(self.attachedView.mas_bottom).offset(self.attachedView.frame.size.height);
}];
[self layoutIfNeeded];
[self.superview layoutIfNeeded];
}

[UIView animateWithDuration:self.animationDuration
Expand All @@ -257,7 +273,7 @@ - (MMPopupBlock)sheetShowAnimation
make.bottom.equalTo(self.attachedView.mas_bottom).offset(0);
}];

[self layoutIfNeeded];
[self.superview layoutIfNeeded];

}
completion:^(BOOL finished) {
Expand Down Expand Up @@ -288,7 +304,7 @@ - (MMPopupBlock)sheetHideAnimation
make.bottom.equalTo(self.attachedView.mas_bottom).offset(self.attachedView.frame.size.height);
}];

[self layoutIfNeeded];
[self.superview layoutIfNeeded];

}
completion:^(BOOL finished) {
Expand Down Expand Up @@ -321,7 +337,7 @@ - (MMPopupBlock)customShowAnimation
[self mas_updateConstraints:^(MASConstraintMaker *make) {
make.center.equalTo(self.attachedView).centerOffset(CGPointMake(0, -self.attachedView.bounds.size.height));
}];
[self layoutIfNeeded];
[self.superview layoutIfNeeded];
}

[UIView animateWithDuration:self.animationDuration
Expand All @@ -335,7 +351,7 @@ - (MMPopupBlock)customShowAnimation
make.center.equalTo(self.attachedView).centerOffset(CGPointMake(0, self.withKeyboard?-216/2:0));
}];

[self layoutIfNeeded];
[self.superview layoutIfNeeded];

} completion:^(BOOL finished) {

Expand Down Expand Up @@ -365,7 +381,7 @@ - (MMPopupBlock)customHideAnimation
make.center.equalTo(self.attachedView).centerOffset(CGPointMake(0, self.attachedView.bounds.size.height));
}];

[self layoutIfNeeded];
[self.superview layoutIfNeeded];

} completion:^(BOOL finished) {

Expand Down
15 changes: 15 additions & 0 deletions Classes/MMPopupWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,21 @@

#import <UIKit/UIKit.h>

//touchWildToHide notification
UIKIT_EXTERN NSString *const MMPopupWindowWildToHideNotification;

@protocol MMPopupWindowWildToHideProtocol <NSObject>

@optional
/**
MMPopupWindowWildToHideHandler
*/
- (void)touchwildToHideHandler;

@end



@interface MMPopupWindow : UIWindow

@property (nonatomic, assign) BOOL touchWildToHide; // default is NO. When YES, popup views will be hidden when user touch the translucent background.
Expand Down
4 changes: 4 additions & 0 deletions Classes/MMPopupWindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#import "MMPopupDefine.h"
#import "MMPopupView.h"

NSString * const MMPopupWindowWildToHideNotification = @"MMPopupWindowWildToHideNotification";

@interface MMPopupWindow()
<
UIGestureRecognizerDelegate
Expand Down Expand Up @@ -68,6 +70,8 @@ - (void)actionTap:(UITapGestureRecognizer*)gesture
{
MMPopupView *popupView = (MMPopupView*)v;
[popupView hide];
//发送通知
[[NSNotificationCenter defaultCenter] postNotificationName:MMPopupWindowWildToHideNotification object:popupView];
}
}
}
Expand Down
Binary file added MMPopupView/.DS_Store
Binary file not shown.
5 changes: 5 additions & 0 deletions MMPopupView/MMPinView.m
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@ - (void)startCountDown
// [self checkCountDown];
}

- (void)touchwildToHideHandler{

NSLog(@"66666");
}

- (void)stopCountDown
{
// [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(checkCountDown) object:nil];
Expand Down
67 changes: 43 additions & 24 deletions MMPopupView/MMPopupView.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
C3A6D7C7352C468FC6AFBD15 /* libPods-MMPopupView.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A4EBFF7F54A0C418E7302440 /* libPods-MMPopupView.a */; };
2CEA378AEA340C8637F54D36 /* libPods-MMPopupView.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B568234704CF4337331B9CAA /* libPods-MMPopupView.a */; };
ED1E99341B9BD5C20093760A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = ED1E99331B9BD5C20093760A /* main.m */; };
ED1E99371B9BD5C20093760A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = ED1E99361B9BD5C20093760A /* AppDelegate.m */; };
ED1E993A1B9BD5C20093760A /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ED1E99391B9BD5C20093760A /* ViewController.m */; };
Expand All @@ -25,8 +25,9 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
41200EBF1F3357F293167C6D /* Pods-MMPopupView.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MMPopupView.debug.xcconfig"; path = "Pods/Target Support Files/Pods-MMPopupView/Pods-MMPopupView.debug.xcconfig"; sourceTree = "<group>"; };
A4EBFF7F54A0C418E7302440 /* libPods-MMPopupView.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-MMPopupView.a"; sourceTree = BUILT_PRODUCTS_DIR; };
9AA0334C18AA365A38A27680 /* Pods-MMPopupView.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MMPopupView.release.xcconfig"; path = "Pods/Target Support Files/Pods-MMPopupView/Pods-MMPopupView.release.xcconfig"; sourceTree = "<group>"; };
B568234704CF4337331B9CAA /* libPods-MMPopupView.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-MMPopupView.a"; sourceTree = BUILT_PRODUCTS_DIR; };
CDDB23700F4179B097716169 /* Pods-MMPopupView.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MMPopupView.debug.xcconfig"; path = "Pods/Target Support Files/Pods-MMPopupView/Pods-MMPopupView.debug.xcconfig"; sourceTree = "<group>"; };
ED1E992F1B9BD5C20093760A /* MMPopupView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MMPopupView.app; sourceTree = BUILT_PRODUCTS_DIR; };
ED1E99331B9BD5C20093760A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
ED1E99351B9BD5C20093760A /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -54,36 +55,35 @@
ED1E995E1B9C22F50093760A /* MMPinView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MMPinView.m; path = ../MMPinView.m; sourceTree = "<group>"; };
EDB365101B9D3323003A0B05 /* MMDateView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMDateView.h; sourceTree = SOURCE_ROOT; };
EDB365111B9D3323003A0B05 /* MMDateView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMDateView.m; sourceTree = SOURCE_ROOT; };
FF8DF09A03ED96B87C4FB5EA /* Pods-MMPopupView.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MMPopupView.release.xcconfig"; path = "Pods/Target Support Files/Pods-MMPopupView/Pods-MMPopupView.release.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
ED1E992C1B9BD5C20093760A /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
C3A6D7C7352C468FC6AFBD15 /* libPods-MMPopupView.a in Frameworks */,
2CEA378AEA340C8637F54D36 /* libPods-MMPopupView.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
04B67B65790C00235A9743EA /* Pods */ = {
A0164A309D756A0891167D70 /* Frameworks */ = {
isa = PBXGroup;
children = (
41200EBF1F3357F293167C6D /* Pods-MMPopupView.debug.xcconfig */,
FF8DF09A03ED96B87C4FB5EA /* Pods-MMPopupView.release.xcconfig */,
B568234704CF4337331B9CAA /* libPods-MMPopupView.a */,
);
name = Pods;
name = Frameworks;
sourceTree = "<group>";
};
72E8955E140DFCE33AE55500 /* Frameworks */ = {
E2DC714EE5FC1189F33235BC /* Pods */ = {
isa = PBXGroup;
children = (
A4EBFF7F54A0C418E7302440 /* libPods-MMPopupView.a */,
CDDB23700F4179B097716169 /* Pods-MMPopupView.debug.xcconfig */,
9AA0334C18AA365A38A27680 /* Pods-MMPopupView.release.xcconfig */,
);
name = Frameworks;
name = Pods;
sourceTree = "<group>";
};
ED1E99261B9BD5C20093760A = {
Expand All @@ -92,8 +92,8 @@
ED1E99491B9BD8340093760A /* Classes */,
ED1E99311B9BD5C20093760A /* MMPopupView */,
ED1E99301B9BD5C20093760A /* Products */,
04B67B65790C00235A9743EA /* Pods */,
72E8955E140DFCE33AE55500 /* Frameworks */,
E2DC714EE5FC1189F33235BC /* Pods */,
A0164A309D756A0891167D70 /* Frameworks */,
);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -160,11 +160,12 @@
isa = PBXNativeTarget;
buildConfigurationList = ED1E99461B9BD5C20093760A /* Build configuration list for PBXNativeTarget "MMPopupView" */;
buildPhases = (
74FFA79FF8D797EA4CE69C18 /* Check Pods Manifest.lock */,
CB006E07D1D1C2E5830FE6F9 /* [CP] Check Pods Manifest.lock */,
ED1E992B1B9BD5C20093760A /* Sources */,
ED1E992C1B9BD5C20093760A /* Frameworks */,
ED1E992D1B9BD5C20093760A /* Resources */,
A788DF5FB597189F611CD16C /* Copy Pods Resources */,
E3A0620399046E4DB316B872 /* [CP] Embed Pods Frameworks */,
48CCF6F27B7DED811E089776 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand All @@ -186,6 +187,7 @@
TargetAttributes = {
ED1E992E1B9BD5C20093760A = {
CreatedOnToolsVersion = 7.0;
DevelopmentTeam = QD5JT3AFJU;
};
};
};
Expand Down Expand Up @@ -221,34 +223,49 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
74FFA79FF8D797EA4CE69C18 /* Check Pods Manifest.lock */ = {
48CCF6F27B7DED811E089776 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Check Pods Manifest.lock";
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-MMPopupView/Pods-MMPopupView-resources.sh\"\n";
showEnvVarsInLog = 0;
};
A788DF5FB597189F611CD16C /* Copy Pods Resources */ = {
CB006E07D1D1C2E5830FE6F9 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Copy Pods Resources";
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-MMPopupView/Pods-MMPopupView-resources.sh\"\n";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
E3A0620399046E4DB316B872 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-MMPopupView/Pods-MMPopupView-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
Expand Down Expand Up @@ -378,11 +395,12 @@
};
ED1E99471B9BD5C20093760A /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 41200EBF1F3357F293167C6D /* Pods-MMPopupView.debug.xcconfig */;
baseConfigurationReference = CDDB23700F4179B097716169 /* Pods-MMPopupView.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = QD5JT3AFJU;
INFOPLIST_FILE = MMPopupView/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
Expand All @@ -394,11 +412,12 @@
};
ED1E99481B9BD5C20093760A /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = FF8DF09A03ED96B87C4FB5EA /* Pods-MMPopupView.release.xcconfig */;
baseConfigurationReference = 9AA0334C18AA365A38A27680 /* Pods-MMPopupView.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = QD5JT3AFJU;
INFOPLIST_FILE = MMPopupView/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
Expand Down
4 changes: 3 additions & 1 deletion MMPopupView/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ DEPENDENCIES:
SPEC CHECKSUMS:
Masonry: 362e8a1cc0beada4a4c4832d5e863da2a51533be

COCOAPODS: 0.39.0.beta.4
PODFILE CHECKSUM: c4ca4688f88d069cced47a34b8071f8ba6290b25

COCOAPODS: 1.2.1
4 changes: 3 additions & 1 deletion MMPopupView/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading