Skip to content

Commit 0fd9391

Browse files
author
weizhen.liu
committed
v1.0.3
1 parent e26f872 commit 0fd9391

16 files changed

+257
-245
lines changed

Example/Podfile.lock

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PODS:
2-
- ZZPopoverWindow (1.0.1)
2+
- ZZPopoverWindow (1.0.2)
33

44
DEPENDENCIES:
55
- ZZPopoverWindow (from `../`)
@@ -9,8 +9,8 @@ EXTERNAL SOURCES:
99
:path: "../"
1010

1111
SPEC CHECKSUMS:
12-
ZZPopoverWindow: e51e556c5cd8e4569c39e7154ec47c10074862f1
12+
ZZPopoverWindow: 41e0056414536f38e87d1999d310b7affa20955b
1313

1414
PODFILE CHECKSUM: cf350e46c46fceaa42534c5255300771c688335c
1515

16-
COCOAPODS: 1.9.3
16+
COCOAPODS: 1.10.1

Example/Pods/Local Podspecs/ZZPopoverWindow.podspec.json

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/Manifest.lock

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/Pods.xcodeproj/project.pbxproj

+164-166
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/Target Support Files/Pods-ZZPopoverWindow_Example/Pods-ZZPopoverWindow_Example-frameworks.sh

+36-58
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/Target Support Files/Pods-ZZPopoverWindow_Example/Pods-ZZPopoverWindow_Example.debug.xcconfig

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/Target Support Files/Pods-ZZPopoverWindow_Example/Pods-ZZPopoverWindow_Example.release.xcconfig

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/Target Support Files/Pods-ZZPopoverWindow_Tests/Pods-ZZPopoverWindow_Tests.debug.xcconfig

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/Target Support Files/Pods-ZZPopoverWindow_Tests/Pods-ZZPopoverWindow_Tests.release.xcconfig

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/Target Support Files/ZZPopoverWindow/ZZPopoverWindow-Info.plist

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/Target Support Files/ZZPopoverWindow/ZZPopoverWindow.debug.xcconfig

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/Target Support Files/ZZPopoverWindow/ZZPopoverWindow.release.xcconfig

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/ZZPopoverWindow/ZZViewController.m

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ - (IBAction)button1Click:(UIButton *)button {
4747

4848
- (void)dismiss {
4949
[self.popover dismiss];
50+
self.popover = nil;
5051
}
5152

5253
- (IBAction)button2Click:(UIButton *)button {

ZZPopoverWindow.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
Pod::Spec.new do |s|
1010
s.name = 'ZZPopoverWindow'
11-
s.version = '1.0.2'
11+
s.version = '1.0.3'
1212
s.summary = 'Pop over view in iOS '
1313
s.description = 'ZZPopoverWindow is a convenience tool of popover view iOS/Objective-C'
1414
s.homepage = 'http://thinkermaster.com/'

ZZPopoverWindow/Classes/ZZPopoverWindow.h

+11-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#import <UIKit/UIKit.h>
1111
#import "ZZPopoverView.h"
1212

13-
@interface ZZPopoverWindow : UIWindow
13+
@interface ZZPopoverWindow : UIView
1414

1515
/**
1616
* The contentView positioned in container, default is zero
@@ -93,6 +93,16 @@
9393
*/
9494
@property (nonatomic, assign) CGFloat minScreenMargin;
9595

96+
/**
97+
* 是否正在显示
98+
*/
99+
@property (nonatomic, assign) BOOL isShowing;
100+
101+
/**
102+
* 父视图,默认 UIApplication.sharedApplication.keyWindow
103+
*/
104+
@property (nonatomic, weak) UIView *superAttachView;
105+
96106
- (void)showAtView:(UIView *)atView;
97107
- (void)showAtView:(UIView *)atView position:(ZZPopoverPosition)position;
98108
- (void)dismiss;

ZZPopoverWindow/Classes/ZZPopoverWindow.m

+21-8
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,17 @@ - (void)showAtView:(UIView *)atView {
6969
return;
7070
}
7171

72-
[self makeKeyWindow];
73-
self.windowLevel = UIWindowLevelAlert;
72+
// ------------------------------------------------------
73+
// From 1.0.3 change window to view
74+
// [self makeKeyWindow];
75+
// self.windowLevel = UIWindowLevelAlert;
7476
self.hidden = NO;
77+
if (self.superAttachView) {
78+
[self.superAttachView addSubview:self];
79+
} else {
80+
[UIApplication.sharedApplication.keyWindow addSubview:self];
81+
}
82+
// ------------------------------------------------------
7583

7684
/**
7785
CGFloat contentWidth = CGRectGetWidth(self.contentView.bounds);
@@ -110,7 +118,12 @@ - (void)righterAnchorPoint {
110118

111119
}
112120

121+
- (void)setFrame:(CGRect)frame {
122+
[super setFrame:frame];
123+
}
124+
113125
- (void)show {
126+
self.isShowing = YES;
114127
if (self.showArrow || self.popoverPosition == ZZPopoverPositionAny) {
115128
self.popView.transform = CGAffineTransformMakeScale(0.0, 0.0);
116129
self.popView.endTransform = CGAffineTransformIdentity;
@@ -211,11 +224,13 @@ - (void)dismiss {
211224
} completion:^(BOOL finished) {
212225
// [self.contentView removeFromSuperview];
213226
[self.popView removeFromSuperview];
214-
[self resignKeyWindow];
227+
//[self resignKeyWindow];
215228
self.hidden = YES;
229+
self.isShowing = NO;
216230
if (self.didDismissHandler) {
217231
self.didDismissHandler();
218232
}
233+
[self removeFromSuperview]; // v1.0.3
219234
}];
220235
}
221236

@@ -224,10 +239,8 @@ - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
224239
[self dismiss];
225240
}
226241

227-
/**
228-
- (void)dealloc {
229-
NSLog(@"dealloc, memory ok");
230-
}
231-
*/
242+
//- (void)dealloc {
243+
// NSLog(@"dealloc, memory ok");
244+
//}
232245

233246
@end

0 commit comments

Comments
 (0)