# GitHub source-code picks, January 4: Bluetooth, launch animations and a custom tab bar

Language: en
Canonical: [GitHub source-code picks, January 4: Bluetooth, launch animations and a custom tab bar](<https://allluckly.cn/en/journal/2016-01-04-github-source-code-picks-january-4-bluetooth-launch-animations-and-a-custom-tab-bar/>)
中文：[中文 HTML](<https://allluckly.cn/%E6%BA%90%E7%A0%81%E6%8E%A8%E8%8D%90/yuanma02>)
English: [English HTML](<https://allluckly.cn/en/journal/2016-01-04-github-source-code-picks-january-4-bluetooth-launch-animations-and-a-custom-tab-bar/>)
Published: 2016-01-04T00:00:00+08:00
Modified: 2026-10-23T10:34:11+08:00
Author: [Bison](<https://allluckly.cn/about/>)

Selects the BabyBluetooth framework, CLClipImageView launch animation and CYLTabBarController tab bar. Project links and selected usage examples introduce the components, including the distinction between Bluetooth central and peripheral modes.

Historical resources collected by Bison. The listed projects belong to their respective authors.

English translation of the [Chinese original](<https://allluckly.cn/%E6%BA%90%E7%A0%81%E6%8E%A8%E8%8D%90/yuanma02>), translated on 2026-10-23. The article body uses automated translation; app descriptions, historical reading notes and video subtitles receive separate editorial checks. Original publication dates, attribution, code and version notes are retained.

**Before you read** This technical note dates from 2015–2017. The examples have not been rerun as part of this archive update. Read API, dependency and tool details in the context of the original publication date.

> “An iOS Bluetooth framework, an eye-catching launch animation, and a loosely coupled custom TabBar.”

- NO.1 The most comprehensive iOS Bluetooth development framework in China ━━∝∞ ∝∞┅┉┉[Download](<https://github.com/coolnameismy/BabyBluetooth>)

> No preview image is available yet.  
>  Usage is as follows.

### Central mode: central model

> The app acts as a central device and connects to other BLE4.0 peripherals.

```css
//导入.h文件和系统蓝牙库的头文件
#import "BabyBluetooth.h"
//定义变量
BabyBluetooth *baby;

-(void)viewDidLoad {
    [super viewDidLoad];

    //初始化BabyBluetooth 蓝牙库
    baby = [BabyBluetooth shareBabyBluetooth];
    //设置蓝牙委托
    [self babyDelegate];
    //设置委托后直接可以使用，无需等待CBCentralManagerStatePoweredOn状态
    baby.scanForPeripherals().begin();
}

//设置蓝牙委托
-(void)babyDelegate{

    //设置扫描到设备的委托
    [baby setBlockOnDiscoverToPeripherals:^(CBCentralManager *central, CBPeripheral *peripheral, NSDictionary *advertisementData, NSNumber *RSSI) {
        NSLog(@"搜索到了设备:%@",peripheral.name);
    }];

    //过滤器
    //设置查找设备的过滤器
    [baby setFilterOnDiscoverPeripherals:^BOOL(NSString *peripheralName) {
    //设置查找规则是名称大于1 ， the search rule is peripheral.name length > 1
    if (peripheralName.length >1) {
        return YES;
    }
        return NO;
    }];

//.......
}
```

```css
//导入.h文件和系统蓝牙库的头文件
#import "BabyBluetooth.h"
//定义变量
BabyBluetooth *baby;

-(void)viewDidLoad {
    [super viewDidLoad];

    //配置第一个服务s1
    CBMutableService *s1 = makeCBService(@"FFF0");
    //配置s1的3个characteristic
    makeCharacteristicToService(s1, @"FFF1", @"r", @"hello1");//读
    makeCharacteristicToService(s1, @"FFF2", @"w", @"hello2");//写
    makeCharacteristicToService(s1, genUUID(), @"rw", @"hello3");//可读写,uuid自动生成
    makeCharacteristicToService(s1, @"FFF4", nil, @"hello4");//默认读写字段
    makeCharacteristicToService(s1, @"FFF5", @"n", @"hello5");//notify字段
    //配置第一个服务s2
    CBMutableService *s2 = makeCBService(@"FFE0");
    makeStaticCharacteristicToService(s2, genUUID(), @"hello6", [@"a" dataUsingEncoding:NSUTF8StringEncoding]);//一个含初值的字段，该字段权限只能是只读

    //实例化baby
    baby = [BabyBluetooth shareBabyBluetooth];
    //配置委托
    [self babyDelegate];
    //启动外设
    baby.bePeripheral().addServices(@[s1,s2]).startAdvertising();
}

//设置蓝牙外设模式的委托
-(void)babyDelegate{

    //设置添加service委托 | set didAddService block
    [baby peripheralModelBlockOnPeripheralManagerDidUpdateState:^(CBPeripheralManager *peripheral) {
    NSLog(@"PeripheralManager trun status code: %ld",(long)peripheral.state);
    }];

    //设置添加service委托 | set didAddService block
    [baby peripheralModelBlockOnDidStartAdvertising:^(CBPeripheralManager *peripheral, NSError *error) {
    NSLog(@"didStartAdvertising !!!");
    }];

    //设置添加service委托 | set didAddService block
    [baby peripheralModelBlockOnDidAddService:^(CBPeripheralManager *peripheral, CBService *service, NSError *error) {
    NSLog(@"Did Add Service uuid: %@ ",service.UUID);
    }];

//.....
}
```

### Peripheral mode: peripheral model

> The app simulates a BLE4.0 peripheral that other devices can connect to and use.  
>  Simulate a peripheral with 2 services and 6 characteristics.

- NO.2 An eye-catching launch animation ━━∝∞ ∝∞┅┉┉ [Download](<https://github.com/TheBlackApple/CLClipImageView>)  

   ![(allluckly.cn)](<https://github.com/TheBlackApple/CLClipImageView/blob/master/CLClipImageAnimation/2015-12-31%2017_20_56.gif?raw=true>)

> Usage is as follows.

```css
- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    //重点在这里
    [CLClipImageView addToCurrentView:self.view clipImage:[UIImage imageNamed:@"Default_image"] backgroundImage:@"" animationComplete:^{
        self.navigationController.navigationBarHidden = NO;
        [self makeTopView];
    }];
}
```

- NO.3 A loosely coupled custom TabBar ━━∝∞ ∝∞┅┉┉[Download](<https://github.com/ChenYilong/CYLTabBarController>)

This historical illustration is currently unavailable. [The original image URL is retained](<https://camo.githubusercontent.com/10b009b8764a0a5eacfd7660fece6627249eb002/687474703a2f2f6935392e74696e797069632e636f6d2f7776787574762e6a7067>) for reference.

> See the download page for detailed usage. The author explains it thoroughly, so I will not repeat it here.

Recommended reading: [Integrating a Baidu Mobile SSP launch ad in one minute](<https://allluckly.cn/en/journal/2015-12-26-integrating-a-baidu-mobile-ssp-launch-ad-in-one-minute/>)

Original article: [https://allluckly.cn/](<https://allluckly.cn/en/>)

