Commit 62a45592dc0cbe5e8228b33f54e0301cd64e6764
1 parent
14ba2e3c
加载图更换
Showing
1 changed file
with
32 additions
and
4 deletions
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Controller/LVCUGCLivePlayerController.m
| ... | ... | @@ -20,6 +20,7 @@ |
| 20 | 20 | float _SecondY; |
| 21 | 21 | float _ThirdY; |
| 22 | 22 | UIView *_tempView; |
| 23 | + LVCUGCPlayerLoadingView *_tempImageView; | |
| 23 | 24 | UIPanGestureRecognizer *_pan; |
| 24 | 25 | LVCUGCPlayerLoadingView *_firstLoadView; |
| 25 | 26 | LVCUGCPlayerLoadingView *_secondLoadView; |
| ... | ... | @@ -208,14 +209,23 @@ |
| 208 | 209 | [_player.view removeFromSuperview]; |
| 209 | 210 | [_player stop]; |
| 210 | 211 | _player = nil; |
| 211 | - // 停止后的视图,拿到自己的加载图来显示 | |
| 212 | - [_viewSecond addSubview:_secondLoadView]; | |
| 213 | 212 | |
| 213 | + //加载图调整. | |
| 214 | + if (_index > 0) { | |
| 215 | + [_thirdLoadView.bgImageView sd_setImageWithURL:[NSURL URLWithString:_playArray[_index - 1].coverImgUrl] placeholderImage:_blurImage]; | |
| 216 | + } | |
| 217 | + _tempImageView = _firstLoadView; | |
| 218 | + _firstLoadView = _thirdLoadView; | |
| 219 | + _thirdLoadView = _secondLoadView; | |
| 220 | + _secondLoadView = _tempImageView; | |
| 221 | + // 视图调整 | |
| 214 | 222 | _viewThird.frame = CGRectMake(0, -SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT); |
| 215 | 223 | _tempView = _viewOne; |
| 216 | 224 | _viewOne = _viewThird; |
| 217 | 225 | _viewThird = _viewSecond; |
| 218 | 226 | _viewSecond = _tempView; |
| 227 | + // 停止后的视图,拿到自己的加载图来显示 | |
| 228 | + [self adjustViewWithLoadView]; | |
| 219 | 229 | |
| 220 | 230 | //往下滑 播放上一个 |
| 221 | 231 | if (_index >= 0) { |
| ... | ... | @@ -301,14 +311,23 @@ |
| 301 | 311 | [_player.view removeFromSuperview]; |
| 302 | 312 | [_player stop]; |
| 303 | 313 | _player = nil; |
| 304 | - // 停止后的视图,拿到自己的加载图来显示 | |
| 305 | - [_viewSecond addSubview:_secondLoadView]; | |
| 306 | 314 | |
| 315 | + //加载图调整 | |
| 316 | + if (_index < _playArray.count - 1) { | |
| 317 | + [_firstLoadView.bgImageView sd_setImageWithURL:[NSURL URLWithString:_playArray[_index + 1].coverImgUrl] placeholderImage:_blurImage]; | |
| 318 | + } | |
| 319 | + _tempImageView = _firstLoadView; | |
| 320 | + _firstLoadView = _secondLoadView; | |
| 321 | + _secondLoadView = _thirdLoadView; | |
| 322 | + _thirdLoadView = _tempImageView; | |
| 323 | + // 视图调整 | |
| 307 | 324 | _viewOne.frame = CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT); |
| 308 | 325 | _tempView = _viewOne; |
| 309 | 326 | _viewOne = _viewSecond; |
| 310 | 327 | _viewSecond = _viewThird; |
| 311 | 328 | _viewThird = _tempView; |
| 329 | + // 停止后的视图,拿到自己的加载图来显示 | |
| 330 | + [self adjustViewWithLoadView]; | |
| 312 | 331 | |
| 313 | 332 | //往上滑 播放下一个 |
| 314 | 333 | if (_index < _playArray.count) { // 判越界 |
| ... | ... | @@ -398,6 +417,15 @@ |
| 398 | 417 | } |
| 399 | 418 | } |
| 400 | 419 | |
| 420 | +- (void)adjustViewWithLoadView { | |
| 421 | + [_firstLoadView removeFromSuperview]; | |
| 422 | + [_secondLoadView removeFromSuperview]; | |
| 423 | + [_thirdLoadView removeFromSuperview]; | |
| 424 | + [_viewOne addSubview:_firstLoadView]; | |
| 425 | + [_viewSecond addSubview:_secondLoadView]; | |
| 426 | + [_viewThird addSubview:_thirdLoadView]; | |
| 427 | +} | |
| 428 | + | |
| 401 | 429 | #pragma mark - Action !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 402 | 430 | -(void)installMovieNotificationObservers //添加视频播放通知监听 |
| 403 | 431 | { | ... | ... |