第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定

我按老師的敲完之后按按鈕怎么沒反應(yīng)有人遇到了相同的情況么

我還按老師的視頻重新看了一遍代碼,還是沒發(fā)現(xiàn)錯誤

正在回答

1 回答

//

//? BulletManager.m

//? CommentDemo

//

//? Created by MacBook on 2017/12/1.

//? Copyright ? 2017年 SimonWest. All rights reserved.

//


#import "BulletManager.h"


#import "BulletView.h"


@interface BulletManager()


@property (nonatomic, strong) NSMutableArray *dataSource;



@property (nonatomic, strong) NSMutableArray *bulletComment;


@property (nonatomic, strong) NSMutableArray *bulletViews;


@property (nonatomic, assign) BOOL bStopAnimation;


@end


@implementation BulletManager


- (instancetype)init {

?? ?

? ? if(self = [super init]) {

?? ? ? ?

? ? ? ? self.bStopAnimation = YES;

?? ? ? ?

? ? }

?? ?

? ? return self;

?? ?

}


- (void)start {

?? ?

? ? if(!self.bStopAnimation) {

?? ? ? ?

? ? ? ? return;

?? ? ? ?

? ? }

?? ?

? ? self.bStopAnimation = NO;

?? ?

? ? [self.bulletComment removeAllObjects];

?? ?

? ? [self.bulletComment addObjectsFromArray:self.dataSource];

?

? ? [self initBulletComment];

?? ?

}


- (void)stop {

?? ?

? ? if(self.bStopAnimation) {

?? ? ? ?

? ? ? ? return;

?? ? ? ?

? ? }

?? ?

? ? self.bStopAnimation = YES;

?? ?

? ? [self.bulletViews enumerateObjectsUsingBlock:^(id? _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {

?? ? ? ?

? ? ? ? BulletView *view = obj;

? ? ? ? [view stopAnimation];

? ? ? ? view = nil;

?? ? ? ?

? ? }];

?? ?

? ? [self.bulletViews removeAllObjects];

?? ?

}


- (void)initBulletComment {

?? ?

? ? NSMutableArray *trajectorys = [NSMutableArray arrayWithArray:@[@(0),@(1),@(2)]];


? ? for (int i = 0; i < 3; i++) {

?? ? ? ?

? ? ? ? if(self.bulletComment.count <= 0) {

?? ? ? ? ? ?

? ? ? ? ? ? break;

?? ? ? ? ? ?

? ? ? ? }

?? ? ? ?

? ? ? ? NSInteger index = arc4random() % trajectorys.count;

?? ? ? ?

? ? ? ? int trajectory = [[trajectorys objectAtIndex:index] intValue];

?? ? ? ?

? ? ? ? [trajectorys removeObjectAtIndex:index];

?? ? ? ?

? ? ? ? NSString *comment = [self.bulletComment firstObject];

? ? ? ? [self.bulletComment removeObject:comment];

?? ? ? ?

? ? ? ? [self createBulletView:comment trajectory:trajectory];

?? ? ? ?

? ? }

?? ?

}


- (void)createBulletView:(NSString *)comment trajectory:(int)trajectory {

?? ?

? ? if(self.bStopAnimation) {

?? ? ? ?

? ? ? ? return;

?? ? ? ?

? ? }

?? ?

? ? BulletView *bulletView = [[BulletView alloc] initWithComment:comment];

? ? bulletView.trajectory = trajectory;

?? ?

? ? __weak typeof(bulletView) weakView = bulletView;

? ? __weak typeof(self) weakSelf = self;

?? ?

? ? bulletView.moveStatusBlock = ^(MoveStataus status){

? ? ? ? if(weakSelf.bStopAnimation) {

?? ? ? ? ? ?

? ? ? ? ? ? return ;

?? ? ? ? ? ?

? ? ? ? }

? ? ? ? switch (status) {

? ? ? ? ? ? case Start:{

?? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? [weakSelf.bulletViews addObject:weakView];

? ? ? ? ? ? ? ? break;

?? ? ? ? ? ? ? ?

? ? ? ? ? ? }

??

? ? ? ? ? ? case Enter:{

?? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? NSString *comment = [weakSelf nextComment];

?? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? if(comment) {

?? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? [weakSelf createBulletView:comment trajectory:trajectory];

?? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? }

?? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? break;

?? ? ? ? ? ? ? ?

? ? ? ? ? ? }

?? ? ? ? ? ? ? ?

? ? ? ? ? ? case End:{

?? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? if([weakSelf.bulletViews containsObject:weakView]) {

?? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? [weakView stopAnimation];

? ? ? ? ? ? ? ? ? ? [weakSelf.bulletViews removeObject:weakView];

?? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? }

?? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? if(weakSelf.bulletViews.count == 0) {

? ? ? ? ? ? ? ? ? ? weakSelf.bStopAnimation = YES;

? ? ? ? ? ? ? ? ? ? [weakSelf start];

?? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? }

?? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? break;

?? ? ? ? ? ? ? ?

? ? ? ? ? ? }

?? ? ? ? ? ? ? ?

? ? ? ? }

?? ? ? ?

?? ? ? ?

?? ? ? ?

?? ? ? ?

? ? };

?? ?

?? ?

?? ?

? ? if(self.generateViewBlock) {

?? ? ? ?

? ? ? ? self.generateViewBlock(bulletView);

?? ? ? ?

? ? }

?? ?

}


- (NSString *)nextComment {

?? ?

? ? if(self.bulletComment.count == 0) {

?? ? ? ?

? ? ? ? return nil;

?? ? ? ?

? ? }

?? ?

? ? NSString *comment = [self.bulletComment firstObject];

?? ?

? ? if(comment) {

?? ? ? ?

? ? ? ? [self.bulletComment removeObjectAtIndex:0];

?? ? ? ?

? ? }

?? ?

? ? return comment;

?? ?

}


- (NSMutableArray *)dataSource {

?? ?

? ? if(!_dataSource) {

?? ? ? ?

? ? ? ? _dataSource = [NSMutableArray arrayWithObjects:@"彈幕1=========",@"彈幕2=========",@"彈幕3===========================",@"彈幕4=========",@"彈幕5=========",@"彈幕6=========",@"彈幕7==", nil];

?? ? ? ?

? ? }

?? ?

? ? return _dataSource;

?? ?

}


- (NSMutableArray *)bulletComment {

?? ?

? ? if(!_bulletComment) {

?? ? ? ?

? ? ? ? _bulletComment = [NSMutableArray array];

?? ? ? ?

? ? }

?? ?

? ? return _bulletComment;

?? ?

}


- (NSMutableArray *)bulletViews {

?? ?

? ? if(!_bulletViews) {

?? ? ? ?

? ? ? ? _bulletViews = [NSMutableArray array];

?? ? ? ?

? ? }

?? ?

? ? return _bulletViews;

?? ?

}


@end


0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

我按老師的敲完之后按按鈕怎么沒反應(yīng)有人遇到了相同的情況么

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號