Commit f17ac0e5 authored by 曹云霄's avatar 曹云霄

修改项说明:增加学习中心图片动画,学习完成无考核情况

parent db498543
......@@ -14,6 +14,27 @@
@implementation AboutViewController
#pragma mark -渲染完成
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
self.navigationController.fd_fullscreenPopGestureRecognizer.enabled = NO;
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.enabled = NO;
}
}
#pragma mark -视图即将消失
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
self.navigationController.fd_fullscreenPopGestureRecognizer.enabled = YES;
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.enabled = YES;
}
}
- (void)viewDidLoad {
[super viewDidLoad];
......
......@@ -176,6 +176,7 @@
CustomWKWebViewController *wkWebView = [[CustomWKWebViewController alloc]init];
TOAttachmentEntity *attachment = self.afficheResult.attachmentUrls[indexPath.row-1];
wkWebView.urlString = attachment.fileUrl;
wkWebView.type = Announcement;
[self presentViewController:wkWebView animated:YES completion:nil];
}
......
......@@ -10,8 +10,11 @@
#import "OnlineLearningViewController.h"
#import "ForumViewController.h"
#import "EmigratedMainViewController.h"
#import "RCAnimatedImagesView.h"
@interface LearningCenterMainViewController ()
@interface LearningCenterMainViewController ()<RCAnimatedImagesViewDelegate>
@property (nonatomic,strong) RCAnimatedImagesView *imageview;
@end
......@@ -31,6 +34,7 @@
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.enabled = NO;
}
[self.imageview startAnimating];
[self queryIntegralDetails];
}
......@@ -45,12 +49,40 @@
}
}
- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
[self.imageview stopAnimating];
}
- (void)viewDidLoad {
[super viewDidLoad];
[self setUpBackImageView];
[self addGestureRecognizer];
}
#pragma mark - 设置背景View
- (void)setUpBackImageView
{
self.imageview = [[RCAnimatedImagesView alloc]initWithFrame:CGRectMake(ZERO, NavigationHeight, ScreenWidth+200, ScreenHeight)];
[self.view addSubview:self.imageview];
[self.view sendSubviewToBack:self.imageview];
self.imageview.delegate = self;
}
#pragma mark - <RCAnimatedImagesViewDelegate>
- (NSUInteger)animatedImagesNumberOfImages:(RCAnimatedImagesView *)animatedImagesView
{
return 2;
}
//返回显示的图片对象
- (UIImage *)animatedImagesView:(RCAnimatedImagesView *)animatedImagesView imageAtIndex:(NSUInteger)index
{
return [UIImage imageNamed:@"Studybackground"];
}
#pragma mark - 添加点击
- (void)addGestureRecognizer
{
......
......@@ -19,6 +19,16 @@
@property (nonatomic,weak) id<BeginAssessmentDelegate>delegate;
/**
开始考核
*/
@property (weak, nonatomic) IBOutlet UIButton *beginAssessmentButton;
/**
考核按钮
*/
@property (nonatomic,assign) BOOL isHidden;
/**
获得积分
......
......@@ -18,6 +18,7 @@
[super viewDidLoad];
self.obtainIntegralLabel.text = [NSString stringWithFormat:@"+%@",_integralString];
self.beginAssessmentButton.hidden = self.isHidden;
}
#pragma mark - 开始考核
......
......@@ -186,6 +186,7 @@
[videoVc resetPlayer];
CustomWKWebViewController *pdfvc = [[CustomWKWebViewController alloc]init];
pdfvc.urlString = studyList.attachment.fileUrl;
pdfvc.type = Study;
[pdfvc setScrollViewEndBottomBlock:^{
[weakSelf dismissViewControllerAnimated:YES completion:^{
[weakSelf videoPlayFinish:studyList];
......@@ -227,6 +228,7 @@
LearningCompleteViewController *assessmentVc = [[[weakSelf class] getLearningCenterStoryboardClass] instantiateViewControllerWithIdentifier:@"LearningCompleteViewController"];
assessmentVc.delegate = weakSelf;
assessmentVc.studyEntity = studyEntity;
assessmentVc.isHidden = !studyEntity.topics.count;
assessmentVc.integralString = integral;
assessmentVc.preferredContentSize = CGSizeMake(520, 450);
weakSelf.settingsPopoverController = [[WYPopoverController alloc] initWithContentViewController:assessmentVc];
......
......@@ -36,9 +36,16 @@
- (void)viewDidLoad {
[super viewDidLoad];
[self uiConfigAction];
[self getPassLevelDeltails];
}
#pragma mark - UI
- (void)uiConfigAction
{
self.answerTableView.backgroundColor = [UIColor clearColor];
}
#pragma mark - 查询题型
- (void)getPassLevelDeltails
{
......@@ -66,9 +73,11 @@
if ([entity.topicType isEqualToString:PASSLEVELTOPICTYPE_GAPFILLING] || [entity.topicType isEqualToString:PASSLEVELTOPICTYPE_SHORTANSWER]) {
AssessmentShortAnswerTableViewCell *shortAnswerCell = [tableView dequeueReusableCellWithIdentifier:@"AssessmentShortAnswerTableViewCell" forIndexPath:indexPath];
shortAnswerCell.entity = entity;
shortAnswerCell.backgroundColor = [UIColor clearColor];
return shortAnswerCell;
}
AssessmentTableViewCell *assessmentCell = [tableView dequeueReusableCellWithIdentifier:@"AssessmentTableViewCell" forIndexPath:indexPath];
assessmentCell.backgroundColor = [UIColor clearColor];
assessmentCell.emigratedEntity = entity.options[indexPath.row];
return assessmentCell;
}
......
......@@ -110,6 +110,26 @@
return _condtionModel;
}
#pragma mark -渲染完成
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
self.navigationController.fd_fullscreenPopGestureRecognizer.enabled = NO;
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.enabled = NO;
}
}
#pragma mark -视图即将消失
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
self.navigationController.fd_fullscreenPopGestureRecognizer.enabled = YES;
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.enabled = YES;
}
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
......
......@@ -235,6 +235,7 @@
29C30BDB1DDC1EE500CA3E29 /* LearningCenterMainViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 29C30BDA1DDC1EE500CA3E29 /* LearningCenterMainViewController.m */; };
29C30BE41DDC3B1300CA3E29 /* OnlineLearningViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 29C30BE31DDC3B1300CA3E29 /* OnlineLearningViewController.m */; };
29C30BE71DDC3B4D00CA3E29 /* OnlineLearningTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 29C30BE61DDC3B4D00CA3E29 /* OnlineLearningTableViewCell.m */; };
29C4C24A1E14BFA20093B100 /* RCAnimatedImagesView.m in Sources */ = {isa = PBXBuildFile; fileRef = 29C4C2491E14BFA20093B100 /* RCAnimatedImagesView.m */; };
29C584E91CDA249300C6F677 /* ProductCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 29C584E81CDA249200C6F677 /* ProductCollectionViewCell.m */; };
29C584ED1CDA429500C6F677 /* ProductDetailsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 29C584EC1CDA429500C6F677 /* ProductDetailsViewController.m */; };
29CB35421CFF0FB60061A5F3 /* ScreeningCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 29CB35411CFF0FB60061A5F3 /* ScreeningCollectionViewCell.m */; };
......@@ -743,6 +744,8 @@
29C30BE31DDC3B1300CA3E29 /* OnlineLearningViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OnlineLearningViewController.m; sourceTree = "<group>"; };
29C30BE51DDC3B4D00CA3E29 /* OnlineLearningTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OnlineLearningTableViewCell.h; sourceTree = "<group>"; };
29C30BE61DDC3B4D00CA3E29 /* OnlineLearningTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OnlineLearningTableViewCell.m; sourceTree = "<group>"; };
29C4C2481E14BFA20093B100 /* RCAnimatedImagesView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCAnimatedImagesView.h; sourceTree = "<group>"; };
29C4C2491E14BFA20093B100 /* RCAnimatedImagesView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCAnimatedImagesView.m; sourceTree = "<group>"; };
29C584E71CDA249200C6F677 /* ProductCollectionViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProductCollectionViewCell.h; sourceTree = "<group>"; };
29C584E81CDA249200C6F677 /* ProductCollectionViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProductCollectionViewCell.m; sourceTree = "<group>"; };
29C584EB1CDA429500C6F677 /* ProductDetailsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProductDetailsViewController.h; sourceTree = "<group>"; };
......@@ -1092,6 +1095,7 @@
2928F7DE1CD085430036D761 /* Tools */ = {
isa = PBXGroup;
children = (
29C4C2471E14BFA20093B100 /* AnaimationImageView */,
29D4C29D1E0CEF5800D256C0 /* TextView */,
2972312F1E0948BE00D8CA9B /* Bank */,
298111131DFE6DFC00F7EAFF /* Category */,
......@@ -2151,6 +2155,15 @@
name = Views;
sourceTree = "<group>";
};
29C4C2471E14BFA20093B100 /* AnaimationImageView */ = {
isa = PBXGroup;
children = (
29C4C2481E14BFA20093B100 /* RCAnimatedImagesView.h */,
29C4C2491E14BFA20093B100 /* RCAnimatedImagesView.m */,
);
path = AnaimationImageView;
sourceTree = "<group>";
};
29C584E51CDA246900C6F677 /* controller */ = {
isa = PBXGroup;
children = (
......@@ -2929,6 +2942,7 @@
29B78C201DFA9AD600C7C6D8 /* STEmoji.m in Sources */,
295DE56C1DDC5DFA00E27725 /* GuideIntegralViewController.m in Sources */,
2906B5D71CD89246000849B4 /* ClientDetailsTableViewCell.m in Sources */,
29C4C24A1E14BFA20093B100 /* RCAnimatedImagesView.m in Sources */,
29BB27801CD9DFD7009A0813 /* AboutViewController.m in Sources */,
2903F93D1DBE57F4003CC6B1 /* JDEcardViewController.m in Sources */,
29F14BAA1CF6B60D0005D3E5 /* QRView.m in Sources */,
......
This diff is collapsed.
//
// RCAnimatedImagesView.h
// RCloudMessage
//
// Created by 杜立召 on 15/3/18.
// Copyright (c) 2015年 RongCloud. All rights reserved.
//
#import <UIKit/UIKit.h>
#define kJSAnimatedImagesViewDefaultTimePerImage 20.0f
@protocol RCAnimatedImagesViewDelegate;
@interface RCAnimatedImagesView : UIView
@property (nonatomic, assign) id<RCAnimatedImagesViewDelegate> delegate;
@property (nonatomic, assign) NSTimeInterval timePerImage;
- (void)startAnimating;
- (void)stopAnimating;
- (void)reloadData;
@end
@protocol RCAnimatedImagesViewDelegate
//返回执行的次数
- (NSUInteger)animatedImagesNumberOfImages:(RCAnimatedImagesView *)animatedImagesView;
//返回显示的图片对象
- (UIImage *)animatedImagesView:(RCAnimatedImagesView *)animatedImagesView imageAtIndex:(NSUInteger)index;
@end
//
// RCAnimatedImagesView.m
// RCloudMessage
//
// Created by 杜立召 on 15/3/18.
// Copyright (c) 2015年 RongCloud. All rights reserved.
//
#import "RCAnimatedImagesView.h"
#define noImageDisplayingIndex -1
#define imageSwappingAnimationDuration 2.0f
#define imageViewsBorderOffset 150
@interface RCAnimatedImagesView()
{
BOOL animating;
NSUInteger totalImages;
NSUInteger currentlyDisplayingImageViewIndex;
NSInteger currentlyDisplayingImageIndex;
}
@property (nonatomic, retain) NSArray *imageViews;
@property (nonatomic, retain) NSTimer *imageSwappingTimer;
- (void)_init;
+ (NSUInteger)randomIntBetweenNumber:(NSUInteger)minNumber andNumber:(NSUInteger)maxNumber;
@end
@implementation RCAnimatedImagesView
@synthesize imageViews = _imageViews;
@synthesize imageSwappingTimer = _imageSwappingTimer;
@synthesize delegate = _delegate,
timePerImage = _timePerImage;
- (id)initWithCoder:(NSCoder *)aDecoder
{
if ((self = [super initWithCoder:aDecoder]))
{
[self _init];
}
return self;
}
- (id)initWithFrame:(CGRect)frame
{
if ((self = [super initWithFrame:frame]))
{
[self _init];
}
return self;
}
- (void)_init
{
NSMutableArray *imageViews = [NSMutableArray array];
for (int i = 0; i < 2; i++)
{
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(-imageViewsBorderOffset*3.3, -imageViewsBorderOffset, self.bounds.size.width + (imageViewsBorderOffset * 2), self.bounds.size.height + (imageViewsBorderOffset * 2))];
imageView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
imageView.contentMode = UIViewContentModeScaleAspectFill;
imageView.clipsToBounds = NO;
[self addSubview:imageView];
[imageViews addObject:imageView];
}
self.imageViews = [imageViews copy];
currentlyDisplayingImageIndex = noImageDisplayingIndex;
}
- (void)startAnimating
{
if (!animating)
{
animating = YES;
[self.imageSwappingTimer fire];
}
}
- (void)bringNextImage
{
UIImageView *imageViewToHide = [self.imageViews objectAtIndex:currentlyDisplayingImageViewIndex];
currentlyDisplayingImageViewIndex = currentlyDisplayingImageViewIndex == 0 ? 1 : 0;
UIImageView *imageViewToShow = [self.imageViews objectAtIndex:currentlyDisplayingImageViewIndex];
NSUInteger nextImageToShowIndex = currentlyDisplayingImageIndex;
do
{
nextImageToShowIndex = [[self class] randomIntBetweenNumber:0 andNumber:totalImages-1];
}
while (nextImageToShowIndex == currentlyDisplayingImageIndex);
currentlyDisplayingImageIndex = nextImageToShowIndex;
imageViewToShow.image = [self.delegate animatedImagesView:self imageAtIndex:nextImageToShowIndex];
static const CGFloat kMovementAndTransitionTimeOffset = 0.1;
[UIView animateWithDuration:self.timePerImage + imageSwappingAnimationDuration + kMovementAndTransitionTimeOffset delay:0.0 options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationCurveLinear animations:^{
NSInteger randomTranslationValueX = imageViewsBorderOffset*3.5-[[self class] randomIntBetweenNumber:0 andNumber:imageViewsBorderOffset];
NSInteger randomTranslationValueY = 0;
CGAffineTransform translationTransform = CGAffineTransformMakeTranslation(randomTranslationValueX, randomTranslationValueY);
CGFloat randomScaleTransformValue = [[self class] randomIntBetweenNumber:115 andNumber:120]/100;
CGAffineTransform scaleTransform = CGAffineTransformMakeScale(randomScaleTransformValue, randomScaleTransformValue);
imageViewToShow.transform = CGAffineTransformConcat(scaleTransform, translationTransform);
} completion:NULL];
[UIView animateWithDuration:imageSwappingAnimationDuration delay:kMovementAndTransitionTimeOffset options:UIViewAnimationOptionBeginFromCurrentState
| UIViewAnimationCurveLinear animations:^{
imageViewToShow.alpha = 1.0;
imageViewToHide.alpha = 0.0;
} completion:^(BOOL finished) {
if (finished)
{
imageViewToHide.transform = CGAffineTransformIdentity;
}
}];
}
- (void)reloadData
{
totalImages = [self.delegate animatedImagesNumberOfImages:self];
[self.imageSwappingTimer fire];
}
- (void)stopAnimating
{
if (animating)
{
[_imageSwappingTimer invalidate];
_imageSwappingTimer = nil;
[UIView animateWithDuration:imageSwappingAnimationDuration delay:0.0 options:UIViewAnimationOptionBeginFromCurrentState animations:^{
for (UIImageView *imageView in self.imageViews)
{
imageView.alpha = 1;
}
} completion:^(BOOL finished) {
currentlyDisplayingImageIndex = noImageDisplayingIndex;
animating = NO;
}];
}
}
- (NSTimeInterval)timePerImage
{
if (_timePerImage == 0)
{
return kJSAnimatedImagesViewDefaultTimePerImage;
}
return _timePerImage;
}
- (void)setDelegate:(id<RCAnimatedImagesViewDelegate>)delegate
{
if (delegate != _delegate)
{
_delegate = delegate;
totalImages = [_delegate animatedImagesNumberOfImages:self];
}
}
- (NSTimer *)imageSwappingTimer
{
if (!_imageSwappingTimer)
{
_imageSwappingTimer = [NSTimer scheduledTimerWithTimeInterval:self.timePerImage target:self selector:@selector(bringNextImage) userInfo:nil repeats:YES];
}
return _imageSwappingTimer;
}
+ (NSUInteger)randomIntBetweenNumber:(NSUInteger)minNumber andNumber:(NSUInteger)maxNumber
{
if (minNumber > maxNumber) {
return [self randomIntBetweenNumber:maxNumber andNumber:minNumber];
}
NSUInteger i = (arc4random() % (maxNumber - minNumber + 1)) + minNumber;
return i;
}
#pragma mark - Memory Management
- (void)dealloc
{
[_imageSwappingTimer invalidate];
}
@end
......@@ -53,6 +53,15 @@
return _webView;
}
#pragma mark -渲染完成
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
self.navigationController.fd_fullscreenPopGestureRecognizer.enabled = YES;
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.enabled = YES;
}
}
- (void)viewDidLoad {
[super viewDidLoad];
......
......@@ -8,9 +8,24 @@
#import "BaseViewController.h"
@interface CustomWKWebViewController : BaseViewController
/**
调用类型
- Announcement: 公告
- Study: 学习
*/
typedef NS_ENUM(NSInteger,CALL_TYPE) {
Announcement = 0,
Study
};
@interface CustomWKWebViewController : BaseViewController
/**
调用类型
*/
@property (nonatomic,assign) CALL_TYPE type;
/**
......
......@@ -155,7 +155,7 @@
CGFloat height = scrollView.frame.size.height;
CGFloat contentYoffset = scrollView.contentOffset.y;
CGFloat distanceFromBottom = scrollView.contentSize.height - contentYoffset;
if (distanceFromBottom <= height) {
if (distanceFromBottom <= height && self.type == Study) {
[self promptBoxWithMessage:@"学习完成,是否开始考核?" cancelBlock:nil sureBlock:^{
if (self.scrollViewEndBottomBlock) {
self.scrollViewEndBottomBlock();
......
......@@ -176,13 +176,13 @@
/**
* 服务器开发地址
*/
//#define SERVERREQUESTURL(URL) [NSString stringWithFormat:@"http://139.196.195.30:8090/opple-web/app%@",URL]
#define SERVERREQUESTURL(URL) [NSString stringWithFormat:@"http://139.196.195.30:8090/opple-web/app%@",URL]
/**
* 服务器测试地址
*/
#define SERVERREQUESTURL(URL) [NSString stringWithFormat:@"http://dg-dev.opple.com/opple-web/app%@",URL]
//#define SERVERREQUESTURL(URL) [NSString stringWithFormat:@"http://dg-dev.opple.com/opple-web/app%@",URL]
//**
// * 服务器正式地址
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment