Skip to content

Commit

Permalink
向外暴露 Prompt View.
Browse files Browse the repository at this point in the history
  • Loading branch information
changsanjiang committed Dec 14, 2017
1 parent f6c647e commit ff98614
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 41 deletions.
2 changes: 1 addition & 1 deletion SJVideoPlayer.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Pod::Spec.new do |s|
s.name = 'SJVideoPlayer'
s.version = '1.2.7'
s.version = '1.2.8'
s.summary = 'video player.'
s.description = 'https://github.com/changsanjiang/SJVideoPlayer/blob/master/README.md'
s.homepage = 'https://github.com/changsanjiang/SJVideoPlayer'
Expand Down
3 changes: 3 additions & 0 deletions SJVideoPlayer/Player/SJVideoPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#import "SJVideoPlayerAssetCarrier.h"
#import "SJVideoPlayerMoreSettingSecondary.h"
#import "SJVideoPlayerSettings.h"
#import <SJPrompt/SJPrompt.h>

NS_ASSUME_NONNULL_BEGIN

Expand Down Expand Up @@ -147,6 +148,8 @@ NS_ASSUME_NONNULL_BEGIN

@interface SJVideoPlayer (Prompt)

@property (nonatomic, strong, readonly) SJPrompt *prompt;

/*!
* duration default is 1.0
*/
Expand Down
74 changes: 39 additions & 35 deletions SJVideoPlayer/Player/SJVideoPlayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#import <MediaPlayer/MPVolumeView.h>
#import "SJVideoPlayerMoreSettingsView.h"
#import "SJVideoPlayerMoreSettingSecondaryView.h"
#import <SJPrompt/SJPrompt.h>
#import <SJOrentationObserver/SJOrentationObserver.h>
#import "SJVideoPlayerRegistrar.h"
#import "SJVolBrigControl.h"
Expand Down Expand Up @@ -1190,21 +1189,23 @@ - (void)setAsset:(SJVideoPlayerAssetCarrier *)asset {
/// 滑入时
self.scrollIn = YES;
self.view.alpha = 1;
[self.view removeFromSuperview];
UITableViewCell *cell = [tableView cellForRowAtIndexPath:self.asset.indexPath];
UIView *superview = [cell.contentView viewWithTag:self.asset.superviewTag];
if ( !superview ) { return;}
[superview addSubview:self.view];
[self.view mas_remakeConstraints:^(MASConstraintMaker *make) {
make.edges.offset(0);
}];
if ( superview && self.view.superview != superview ) {
[self.view removeFromSuperview];
[superview addSubview:self.view];
[self.view mas_remakeConstraints:^(MASConstraintMaker *make) {
make.edges.offset(0);
}];
}
}
else {
if ( NO == self.scrollIn ) return;
/// 滑出时
self.scrollIn = NO;
self.view.alpha = 0.001;
[self pause];
self.hideControl = NO;
}
}
else if ( [asset.scrollView isKindOfClass:[UICollectionView class]] ) {
Expand All @@ -1218,46 +1219,49 @@ - (void)setAsset:(SJVideoPlayerAssetCarrier *)asset {
[self.view removeFromSuperview];
UICollectionViewCell *cell = [collectionView cellForItemAtIndexPath:self.asset.indexPath];
UIView *superview = [cell.contentView viewWithTag:self.asset.superviewTag];
if ( !superview ) return;
[superview addSubview:self.view];
[self.view mas_remakeConstraints:^(MASConstraintMaker *make) {
make.edges.offset(0);
}];
if ( superview && self.view.superview != superview ) {
[self.view removeFromSuperview];
[superview addSubview:self.view];
[self.view mas_remakeConstraints:^(MASConstraintMaker *make) {
make.edges.offset(0);
}];
}
}
else {
if ( NO == self.scrollIn ) return;
/// 滑出时
self.scrollIn = NO;
self.view.alpha = 0.001;
[self pause];
self.hideControl = NO;
}
}
};
}

static __weak UIView *tmpView = nil;
- (UIView *)_getSuperviewWithContentView:(UIView *)contentView tag:(NSInteger)tag {
if ( contentView.tag == tag ) return contentView;

[self _searchingWithView:contentView tag:tag];
UIView *target = tmpView;
tmpView = nil;
return target;
}

- (void)_searchingWithView:(UIView *)view tag:(NSInteger)tag {
if ( tmpView ) return;
[view.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if ( obj.tag == tag ) {
*stop = YES;
tmpView = obj;
}
else {
[self _searchingWithView:obj tag:tag];
}
}];
return;
}
//static __weak UIView *tmpView = nil;
//- (UIView *)_getSuperviewWithContentView:(UIView *)contentView tag:(NSInteger)tag {
// if ( contentView.tag == tag ) return contentView;
//
// [self _searchingWithView:contentView tag:tag];
// UIView *target = tmpView;
// tmpView = nil;
// return target;
//}
//
//- (void)_searchingWithView:(UIView *)view tag:(NSInteger)tag {
// if ( tmpView ) return;
// [view.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
// if ( obj.tag == tag ) {
// *stop = YES;
// tmpView = obj;
// }
// else {
// [self _searchingWithView:obj tag:tag];
// }
// }];
// return;
//}

- (SJVideoPlayerAssetCarrier *)asset {
return objc_getAssociatedObject(self, _cmd);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -763,14 +763,14 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = U5A7L7SMNP;
DEVELOPMENT_TEAM = DB5B5F2RH5;
INFOPLIST_FILE = SJVideoPlayerProject/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.dancebaby.lanwuzhe;
PRODUCT_BUNDLE_IDENTIFIER = com.sanjiang.videoplayer;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "fa6d274f-eca0-4b49-aded-9969891b1a62";
PROVISIONING_PROFILE_SPECIFIER = DevProfile;
PROVISIONING_PROFILE = "acd2453e-e396-4ccf-bf56-508276824c6c";
PROVISIONING_PROFILE_SPECIFIER = SanJiangDevelopment;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -785,7 +785,7 @@
INFOPLIST_FILE = SJVideoPlayerProject/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.dancebaby.lanwuzhe;
PRODUCT_BUNDLE_IDENTIFIER = com.sanjiang.videoplayer;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
TARGETED_DEVICE_FAMILY = "1,2";
Expand Down
Binary file not shown.

0 comments on commit ff98614

Please sign in to comment.