• Stars
    star
    104
  • Rank 330,604 (Top 7 %)
  • Language
    Swift
  • License
    MIT License
  • Created over 8 years ago
  • Updated about 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

TKDotSegment is a segment with dot animation

TKDotSegment

A segment with dot animation

Swift Version License MIT CocoaPods CocoaPods Carthage compatible Support

Requirements

  • iOS 8.0+
  • Xcode 9.0
  • Swift 4.0

Installation

CocoaPods

You can use CocoaPods to install TKDotSegment by adding it to your Podfile:

platform :ios, '8.0'
use_frameworks!
pod 'TKDotSegment'

To get the full benefits import TKDotSegment wherever you import UIKit

import UIKit
import TKDotSegment

Carthage

Create a Cartfile that lists the framework and run carthage update. Follow the instructions to add $(SRCROOT)/Carthage/Build/iOS/TKDotSegment.framework to an iOS project.

github "tbxark/TKDotSegment"

Manually

  1. Download and drop TKDotSegmentControl.swift in your project.
  2. Congratulations!

Usage example


let titles = ["First", "Second", "Third", "Fourth"]
let  segment = TKDotSegmentControl(titles: titles, frame: CGRect(x: 0, y: 0, width: 300, height: 40))
segment.dotColor = UIColor(red:1,  green:0.539,  blue:0.490, alpha:1)
segment.selectTitleColor = UIColor(red:1,  green:0.539,  blue:0.490, alpha:1)
segment.numOfDot = 4
segment.dotSpace = 6
segment.clickAction = { (index: Int, changeOffset: Bool) in
    print("Segment Select Index: \(index)")
}

Base

变量名 描述 Description
titles 选项标题 segment title
numOfDot 圆点数目 dot count
dotDiameter 圆点直径 dot diameter
dotSpace 圆点间距(负数则自动计算) dot space(automatic calculation when value is a positive number)
dotColor 圆点颜色 dot color
selectTitleColor 标题被选中时的颜色 The color of the title is selected
unSelectTitleColor 标题未被选中时的颜色 The color of the title is not selected
titleFont 标题字体 The font of the title
PLDot 圆点(可重写drawRect来自定义形状) Override drawRect to customize shape

1 . 改变 Index (change index)

    func changeSelectedIndex(index: Int, animate: Bool = true)

2 . 接受 Index 变化事件 (index value change event)

TKDotSegmentAction = (index: Int,  internaliFlag: Bool) -> Void

index 被选择的 index (selected index)

internaliFlag 是否内部点击触发的标志位 (event by click flag)

3 . 自定义圆点形状(Custom dot shape)

重写PLDotdrawRect 方法就可以了

Overwrite the drawRect of PLDot

Release History

  • 1.4.0 Support swift 4.0

  • 1.3.1 Support swift 3.0

  • 1.0.2 Complete basic functions, add Cocoapod and Carthage support

Contribute

We would love for you to contribute to TKDotSegment, check the LICENSE file for more info.

Meta

TBXark – @tbxark[email protected]

Distributed under the MIT license. See LICENSE for more information.

https://github.com/TBXark

More Repositories

1

ChatGPT-Telegram-Workers

Deploy your own Telegram ChatGPT bot on Cloudflare Workers with ease.
TypeScript
3,466
star
2

TKRubberIndicator

A rubber animation pagecontrol
Swift
1,439
star
3

TKSwitcherCollection

An animation switch collection
Swift
914
star
4

PinterestSegment

A Pinterest-like segment control with masking animation.
Swift
687
star
5

Ruler

An AR ruler app can measure length & area
Swift
246
star
6

mail2telegram

Forward email to telegram with Cloudflare Email Routing
JavaScript
218
star
7

TKRadarChart

A customizable radar chart in Swift
Swift
210
star
8

PasswordX

Offline password manager for iOS/macOS
Swift
29
star
9

tbxark.github.io

TBXark' blog
JavaScript
25
star
10

poe-telegram-bot

A lightweight poe chatbot for telegram
Python
18
star
11

shell-ask

Ask LLM directly from your terminal using a pure bash script
Shell
18
star
12

github-backup

A simple tool to backup github repository to gitea or other provider.
Go
16
star
13

ScrollViewThumbnail

Quickly create thumbnails for zoomed views in UIScrollview with just a single line of code.
Swift
14
star
14

g4vercel

Go web server for vercel
Go
10
star
15

TKSectorProgressView

An simple animation sector progress view
Swift
10
star
16

numberbarn2telegram

Forward the text message from NumberBarn to Telegram.
JavaScript
8
star
17

chatgpt-prompt-helper

A Tampermonkey script for quickly copying prompts in the web version of ChatGPT.
JavaScript
8
star
18

telegram-bot-vapor-example

Create telegram bot by swift
Swift
7
star
19

testmail-viewer

An online preview tool for Testmail.
Vue
6
star
20

JSONElement

JSONElement makes it easier and safer to use JSON
Swift
6
star
21

FlexLayout

Flex layout library similar to SwiftUI
Swift
6
star
22

chat-bot-go

A lightweight chatgpt bot for telegram
Go
5
star
23

SwiftCache

A pure swift cache framework
Swift
4
star
24

TrieRouter

A simple framework for application routing.
Swift
4
star
25

swift-telegram-bot-api

Swift Telegram Bot API and Telegram Bot API Generator
Swift
3
star
26

NetworkService

NetworkService with Alamofire and RxSwift
Swift
3
star
27

my-leetcode-code

LeetCode is a platform for preparing technical coding interviews.
Swift
3
star
28

vercel-proxy

Simple http proxy for Vercel.
Go
3
star
29

proxy-config-worker

[Deprecated] An online proxy configuration adaptation tool for Cloudflare worker.
JavaScript
2
star
30

autorun

autorun is a tool that listens for file changes and automatically executes commands.
Go
2
star
31

TBXark

Hi there, I'm TBXark~
2
star
32

rmock

Modify HTTP JSON responses without needing HTTP capture and MitM.
JavaScript
2
star
33

PiPlayground

可以由网页控制的提词器
Swift
2
star
34

RxSwiftLearnDemo

This is example code for RxSwift
Swift
2
star
35

MinesWeeping

A simple MinesWeeping Game
Swift
2
star
36

cloudflare-worker-adapter

Run your script without Cloudflare Workers.
TypeScript
2
star
37

gitea-mirror-reauth

Quickly modify the authorization information of a Gitea mirror repository.
Go
1
star
38

redmine-summary

redmine 周报生成工具
JavaScript
1
star
39

tic-tac

三子棋游戏,每人最多只能下三颗棋子,当下第四颗棋子时,最先那一颗棋子会消失
JavaScript
1
star
40

temporary-encrypted-clipboard

Clipboard encryption script for secure password transfer across devices.
JavaScript
1
star
41

dart_router

A simple framework for application routing.
Dart
1
star
42

mweb-export

A tool for generating directories from MWeb files.
Go
1
star
43

TKPlaceholderTextView

A textview with placeholder
Swift
1
star
44

Observable

A simple observer framework in Swift
Swift
1
star
45

Watermark

Swift
1
star
46

YoukuInfo

A simple youku crawler
HTML
1
star
47

azure2openai

A simple tool to proxy OpenAI‘s request to Azure OpenAI Service
Go
1
star
48

telegram-bot-workers-template

The basic template for running a Telegram Bot on Cloudflare Workers.
TypeScript
1
star