ALBusSeatView 0.2.5

ALBusSeatView 0.2.5

Soner Güler 维护。




ALBusSeatView💺

Version License Platform

示例

要运行示例项目,首先克隆仓库,然后在示例目录中运行 pod install

屏幕截图

开始 选择 性别选择 好了!

安装

ALBusSeatView 可以通过 CocoaPods 获取。要安装它,只需将以下行添加到您的 Podfile 中

pod 'ALBusSeatView'

用法

// If you want to config more
// let config = ALBusSeatViewConfig()
// ALBusSeatView(withConfig: config)

let seatView = ALBusSeatView()
seatView.delegate = self
seatView.dataSource = self

view.addSubview(seatView)

//ALBusSeatViewDataSource

func seatView(_ seatView: ALBusSeatView, numberOfSeatInSection section: Int) -> Int {
     return 43 // Total seat count
}

func seatView(_ seatView: ALBusSeatView, seatNumberForIndex indexPath: IndexPath) -> String {
    return "10" // Seat Number
}

func seatView(_ seatView: ALBusSeatView,
              seatTypeForIndex indexPath: IndexPath) -> ALBusSeatType {
        
    return .empty
}


// Seat Types

public enum ALBusSeatType: Int {
    /// Free to pick
    case empty
    /// Already sold by woman or man
    case sold
    /// Being selected
    case selected
    /// Already sold by woman
    case soldWoman
    /// Already sold by man
    case soldMan
    /// Not a seat. Can not be able to select
    case none
}

文档

配置(ALBusSeatViewConfig)

布局

参数 说明 默认值 类型
leftHandDrivePosition 左手驾驶位置状态 True 布尔型
marginBetweenSeats 座椅间距离 5.0 CGFloat

座椅

参数 说明 默认值 类型
seatEmptyBGColor 空座颜色 .white UIColor
seatSoldBGColor 被男女购买的座位颜色。 (普通座位) .gray UIColor
seatSelectedBGColor 选中座位颜色 .green UIColor
seatSoldWomanBGColor 女性购买的座位颜色 .red UIColor
seatSoldManBGColor 男性购买的座位颜色 .blue UIColor
seatCornerRadius 座椅圆角半径 8.0 CGFloat
seatBorderColor 座椅边框颜色 .clear UIColor
seatBorderWidth 座椅边框宽度 0 CGFloat
seatShadowColor 座椅阴影颜色 .lightGray UIColor
seatShadowRadius 座椅阴影半径 5.0 CGFloat
seatShadowSize 座椅阴影大小 1,1 CGSize
seatShadowOpacity 座椅阴影不透明度 0.7 Float
seatRemoveImage 选中座位的移除按钮图像 nil UIImage?
seatNumberFont 座椅号码标签字体 .system(15) UIFont
seatNumberSelectedFont 选中座椅号码标签字体 .systemBold(15) UIFont
seatNumberColor 座椅号码标签颜色 .black UIColor
seatNumberSelectedColor 选中座椅号码标签颜色 .white UIColor

候车厅

参数 说明 默认值 类型
centerHallHeight 候车厅高度 20 CGFloat
centerHallInfoText 候车厅信息标签文本 "" String
centerHallInfoTextColor 候车厅信息标签文本颜色 .black UIColor
centerHallInfoTextFont 候车厅信息标签文本字体 .system(12) UIFont

公交车前部区域

参数 说明 默认值 类型
busFrontImage 公交车前部图片 nil UIImage?
busFrontImageWidth 公交车前部图片宽度 50 CGFloat

公交车地板区域

参数 说明 默认值 类型
floorSeperatorWidth 地板分区宽度 50 CGFloat
floorSeperatorImage 地板分区图片 nil UIImage?

性别提示信息

参数 说明 默认值 类型
tooltipText 性别选择提示标题 "Select Gender" String

作者

sonifex, [email protected]

许可证

ALBusSeatView遵从MIT许可证。详细信息请参阅LICENSE文件。