旋转菜单和tab ,留着以后要实现类似效果时看

本文介绍两款iOS自定义UI组件:KYCircleMenu和KYArcTab。KYCircleMenu是一个带有切换动画的圆形菜单,支持按钮数量自定义;KYArcTab是一个带切换动画的弧形标签视图控制器,支持2到4个标签,可通过滑动进行切换。文章提供了详细的使用方法及初始化参数。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

https://github.com/Kjuly/KYCircleMenu

https://github.com/Kjuly/KYArcTab


KYCircleMenu

A circle menu with toggling animation. And you can customize the number of buttons between (1 ~ 6).

This control is separated from iPokeMon (a PokéMon game on iOS with Location Based Service), you can take a look at the demo video how cool it is!

Usage

Designated Initializer

Use the designated initializer below to initialize the circle menu:

// |buttonCount| : count of buttons around (1<= x <=6)
// |menuSize| : size of menu
// |buttonSize| : size of buttons around
// |buttonImageNameFormat| : name format for button image
// |centerButtonSize| : size of center button
// |centerButtonImageName| : name for center button image
// |centerButtonBackgroundImageName| : name for center button background image
- (id)      initWithButtonCount:(NSInteger)buttonCount
                       menuSize:(CGFloat)menuSize
                     buttonSize:(CGFloat)buttonSize
          buttonImageNameFormat:(NSString *)buttonImageNameFormat
               centerButtonSize:(CGFloat)centerButtonSize
          centerButtonImageName:(NSString *)centerButtonImageName
centerButtonBackgroundImageName:(NSString *)centerButtonBackgroundImageName;

Button Action

Override the -runButtonActions: message to customize your button action:

- (void)runButtonActions:(id)sender {
  [super runButtonActions:sender];

  // Do buttons' action appropriately by |[sender tag]|
  // ...
}

Tags are defined like below:

TAG:        1       1   2      1   2     1   2     1 2 3     1 2 3
           \|/       \|/        \|/       \|/       \|/       \|/
COUNT: 1) --|--  2) --|--   3) --|--  4) --|--  5) --|--  6) --|--
           /|\       /|\        /|\       /|\       /|\       /|\
TAG:                             3       3   4     4   5     4 5 6

Navigation Bar

The default case is that the navigation bar is only shown in child views. If you want it to be shown with the circle menu together, add the macro below

#define KY_CIRCLEMENU_WITH_NAVIGATIONBAR 1

to your constatns.h or config.h, or any other files that are imported in your <Project>-Prefix.pch.




KYArcTab

Arcuated tab view controller with toggleing animation, 2 ~ 4 tabs are enabled. What's more, you can swipe left or right to toggle the views.

Usage

Subclass KYArcTabViewController and override the -setup message to configure the child view controllers.

Then use the designated initializer below to initialize the tab view controller when you need:

- (id)  initWithTitle:(NSString *)title                // title
           tabBarSize:(CGSize)tabBarSize               // size of tab bar
tabBarBackgroundColor:(UIColor *)tabBarBackgroundColor // background color of tab bar
             itemSize:(CGSize)itemSize                 // size of items on tab bar
                arrow:(UIImage *)arrow;                // arrow on the tab bar


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值