日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

java演出厅选票_高仿猫眼电影选座(选票)模块-b

發布時間:2023/12/2 编程问答 52 豆豆
生活随笔 收集整理的這篇文章主要介紹了 java演出厅选票_高仿猫眼电影选座(选票)模块-b 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

上圖看效果先:

1)畫座位圖其實不是很難一般數據都會給坐標,將坐標對應座位畫出來就可以了,主要是開場動畫要設置默認大小,還有座位圖的數量也不是固定的,所以在初始化座位圖的時侯就默認算出了整個座位圖的大小

-(instancetype)initWithSeatsArray:(NSMutableArray *)seatsArray maxNomarWidth:(CGFloat)maxW seatBtnActionBlock:(void (^)(id))actionBlock{

if (self = [super init]) {

self.actionBlock = actionBlock;

ZFSeatsModel *seatsModel = seatsArray.firstObject;

NSUInteger cloCount = [seatsModel.columns count];

if (cloCount % 2) cloCount += 1;//偶數列數加1 防止中線壓住座位

CGFloat seatViewW = maxW - 2 * ZFseastsRowMargin;

CGFloat seatBtnW = seatViewW / cloCount;

if (seatBtnW > ZFseastMinW_H) {

seatBtnW = ZFseastMinW_H;

seatViewW = cloCount * ZFseastMinW_H;

}

//初始化就回調算出按鈕和自身的寬高

CGFloat seatBtnH = seatBtnW;

self.seatBtnWidth = seatBtnW;

self.seatBtnHeight = seatBtnH;

self.seatViewWidth = seatViewW;

self.seatViewHeight = [seatsArray count] * seatBtnH;

//初始化座位

[self initSeatBtns:seatsArray];

}

return self;

}

2)畫側邊的索引條 主要就是算出總共有多少列,有沒走到之類的 將座位列號根據每個豎向坐標直接畫進索引條就可以了

//畫索引條

- (void)drawRect:(CGRect)rect {

NSDictionary *attributeName = @{NSFontAttributeName: [UIFont systemFontOfSize:10],NSForegroundColorAttributeName : [UIColor whiteColor]};

CGFloat NuomberTitleH = (self.height - 2 * 10) / self.indexsArray.count;

[self.indexsArray enumerateObjectsUsingBlock:^(ZFSeatsModel *seatsModel, NSUInteger idx, BOOL *stop) {

CGSize strsize = ?[seatsModel.rowId sizeWithAttributes:attributeName];

[seatsModel.rowId drawAtPoint:CGPointMake(self.width * 0.5 - strsize.width ?* 0.5,10 + idx * NuomberTitleH + NuomberTitleH ?* 0.5 - strsize.height ?* 0.5) withAttributes:attributeName];

}];

}

3)中線啟示也是自定義一個view畫一條線線上是label,每次隨座位圖上下滾動,重新設置自身高度重繪該線條就能達到效果

-(void)setHeight:(CGFloat)height{

[super setHeight:height];

[self setNeedsDisplay];

}

- (void)drawRect:(CGRect)rect {

CGContextRef context = UIGraphicsGetCurrentContext();

CGContextSetLineWidth(context, 1.0);

CGContextSetStrokeColorWithColor(context, [UIColor darkGrayColor].CGColor);

CGFloat lengths[] = {6,3};

CGContextSetLineDash(context, 0, lengths,2);

CGContextMoveToPoint(context, 0, 0);

CGContextAddLineToPoint(context, 0, self.bounds.size.height);

CGContextStrokePath(context);

}

4)每次座位圖滾動的時候隨著偏移量的變化更新其他所有控件的坐標就能達到某一方向跟隨scrollview滾動方向移動

- (void)scrollViewDidScroll:(UIScrollView *)scrollView{

// 更新applogo

if (scrollView.contentOffset.y <= scrollView.contentSize.height - self.height +ZFseastsColMargin + 15) {

self.maoyanLogo.y = CGRectGetMaxY(self.seatView.frame) + 35;

self.maoyanLogo.centerX = self.seatView.centerX;

}else{

self.maoyanLogo.centerX = self.seatView.centerX;

self.maoyanLogo.y = scrollView.contentOffset.y + self.height - self.maoyanLogo.height;

}

//更新hallLogo

self.hallLogo.y = scrollView.contentOffset.y;

//更新中線

self.centerLine.height = CGRectGetMaxY(self.seatView.frame) + 2 * ZFSmallMargin;

if (scrollView.contentOffset.y < - ZFseastsColMargin ) {

self.centerLine.y = self.seatView.y - ZFseastsColMargin + ZFCenterLineY;

}else{

self.centerLine.y = scrollView.contentOffset.y + ZFCenterLineY;

self.centerLine.height = CGRectGetMaxY(self.seatView.frame) - scrollView.contentOffset.y - 2 * ZFCenterLineY + ZFseastsColMargin;

}

// 更新索引條

self.rowindexView.x = scrollView.contentOffset.x + ZFseastMinW_H;

//更新indicator大小位置

[self.indicator updateMiniIndicator];

if (!self.indicator.hidden || self.seatScrollView.isZoomBouncing)return;

self.indicator.alpha = 1;

self.indicator.hidden = NO;

}

最后不多解釋啦上Github地址:https://github.com/ZFbaby/ZFSeatsSelection/blob/master/ZFSeatsSelection

總結

以上是生活随笔為你收集整理的java演出厅选票_高仿猫眼电影选座(选票)模块-b的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。