OCBorghettiView 0.0.6

OCBorghettiView 0.0.6

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布最新发布2014年12月

Otavio Cordeiro 维护。



  • Otavio Cordeiro

OCBorghettiView 是一个易于使用的iOS'accordion'视图组件。该名称是为了纪念一个巴西民间音乐家兼作曲家 Renato Borghetti,他以其来自家乡里约格兰德杜索的传统风格作品而闻名。Borghetti 的主要乐器是全音阶按钮手风琴(在巴西葡萄牙语中称为“gaita”)。

内部机制

  • 设计上可重用
  • 为 iPhone 和 iPad 构建
  • 使用 ARC(自动引用计数)
  • 支持设备旋转
  • 支持自定义
  • 支持使用 UIViews 作为部分(UITableViews,UIWebView,MKMapView 等)

如何安装?

CocoaPods 是安装 OCBorghettiView 的最简单方式。运行 pod search OCBorghettiView 来搜索最新版本。然后,将 pod 行复制并粘贴到您的 Podfile 中。您的 Podfile 应该类似于

platform :ios, '6.0'
pod 'OCBorghettiView', '~> X.Y.Z'

最后,通过运行 pod install 来安装它。

如果您不使用 CocoaPods,请从 OCBorghettiView/ 将 .m、.h 和 .bundle 文件导入到您的项目中。

如何贡献?

  1. 对该项目进行分叉并克隆。
  2. 进行您的更改(并添加/修改您的更改规格)
  3. 确保所有规格都正确无误
  4. 将更改推送到您的分叉并发起一个拉取请求。

如何使用?

OCBorghettiView 类

@interface OCBorghettiView : UIView

- (void)addSectionWithTitle:(NSString *)sectionTitle
                    andView:(id)sectionView;

@property (nonatomic, assign) NSInteger activeSection;
@property (nonatomic, assign) NSInteger headerHeight;
@property (nonatomic, strong) UIFont *headerFont;
@property (nonatomic, strong) UIColor *headerTitleColor;
@property (nonatomic, strong) UIColor *headerColor;
@property (nonatomic, strong) UIColor *headerBorderColor;
@property (nonatomic, assign) id <OCBorghettiViewDelegate> delegate;

@end

OCBorghettiViewDelegate 协议

@protocol OCBorghettiViewDelegate <NSObject>

@optional

- (void)accordion:(OCBorghettiView *)accordion
   willSelectView:(UIView *)view
        withTitle:(NSString *)title;

- (BOOL)accordion:(OCBorghettiView *)accordion
 shouldSelectView:(UIView *)view
        withTitle:(NSString *)title;

- (void)accordion:(OCBorghettiView *)accordion
    didSelectView:(UIView *)view
        withTitle:(NSString *)title;

@end

示例

- (void)viewDidLoad
{
    [super viewDidLoad];

    // Initialization
    OCBorghettiView *accordion = [[OCBorghettiView alloc] initWithFrame:frame];

    // Settings and colors
    accordion.headerHeight = 40;
    accordion.headerFont = [UIFont fontWithName:@"Avenir" size:16];
    accordion.headerBorderColor = [UIColor darkGrayColor];
    accordion.headerColor = [UIColor grayColor];

    [self.view addSubview:accordion];

    // Section One
    UIView *sectionOne = [[UIView alloc] init];
    [sectionOne setBackgroundColor:[UIColor redColor]];
    [accordion addSectionWithTitle:@"Section One"
                           andView:sectionOne];

    // Section Two
    UIView *sectionTwo = [[UIView alloc] init];
    [sectionTwo setBackgroundColor:[UIColor greenColor]];
    [accordion addSectionWithTitle:@"Section Two"
                           andView:sectionTwo];

    // Section Three
    UIView *sectionThree = [[UIView alloc] init];
    [sectionThree setBackgroundColor:[UIColor yellowColor]];
    [accordion addSectionWithTitle:@"Section Three"
                           andView:sectionThree];
}

许可证

版权(c)2014 Otavio Cordeiro。保留所有权利。

根据以下条件,授予任何获得本软件及相关文档副本(“软件”)的人免费处置软件的权利,包括但不限于使用、复制、修改、合并、发布、分发、再许可和/或出售软件副本的权利,并允许软件接收人做自己想做的事情:

以上版权声明和本许可声明应包含在软件的所有副本或主要部分中。

本软件按“原样”提供,不提供任何形式的保证,无论是明确的还是隐含的,包括但不限于对适销性、针对特定目的的适用性和非侵权的保证。在任何情况下,作者或版权所有者都不应对任何索赔、损害或其他责任承担责任,无论该索赔、损害或其他责任是由于合同行为、侵权行为或其他行为引起的,无论是否与软件、使用或软件的其他处理有关。