CarbonKit 2.3.1

CarbonKit 2.3.1

测试已测试
Lang语言 Obj-CObjective C
许可证 MIT
发布最后发布2019年9月

Ermal Kaleci 维护。



CarbonKit 2.3.1

alt tag

Carthage compatible CocoaPods compatible License: MIT

重要注意事项:请不要提交有关您代码的问题。只有真实的错误或功能请求会被回答,其他所有都会被关闭且不做评论。在报告错误的情况下,请包括截图和重现错误的代码。

CarbonKit 是一个开源的 iOS 库,包括强大和美观的用户界面组件。

CarbonKit 包括

  • CarbonSwipeRefresh
  • CarbonTabSwipeNavigation

Carthage

将以下行添加到您的 Cartfile 中

github "ermalkaleci/CarbonKit"

运行 carthage update

CocoaPods

CarbonKit 在 CocoaPods 上可用。将其添加到您的 Podfile 中

use_frameworks!
pod 'CarbonKit'

运行 pod install

CarbonTabSwipeNavigation

alt tag

示例代码

#import "CarbonKit.h"

@interface ViewController () <CarbonTabSwipeNavigationDelegate>
@end

@implementation ViewController

- (void)viewDidLoad {
	[super viewDidLoad];

	NSArray *items = @[[UIImage imageNamed:@"home"], [UIImage imageNamed:@"hourglass"],
	[UIImage imageNamed:@"premium_badge"], @"Categories", @"Top Free",
	@"Top New Free", @"Top Paid", @"Top New Paid"];

	CarbonTabSwipeNavigation *carbonTabSwipeNavigation =
	[[CarbonTabSwipeNavigation alloc] initWithItems:items delegate:self];
	[carbonTabSwipeNavigation insertIntoRootViewController:self];
	// or [carbonTabSwipeNavigation insertIntoRootViewController:self andTargetView:yourView];
}

// delegate
- (UIViewController *)carbonTabSwipeNavigation:(CarbonTabSwipeNavigation *)carbonTabSwipeNavigation
			 viewControllerAtIndex:(NSUInteger)index {
	// return viewController at index
}

@end

Swift 示例

import CarbonKit

class ViewController: UIViewController, CarbonTabSwipeNavigationDelegate {

    // MARK: Override methods
    override func viewDidLoad() {
        super.viewDidLoad()
        let items = ["Features", "Products", "About"]
        let carbonTabSwipeNavigation = CarbonTabSwipeNavigation(items: items, delegate: self)
        carbonTabSwipeNavigation.insertIntoRootViewController(self)
		// or carbonTabSwipeNavigation.insertIntoRootViewController(self, andTargetView: yourView)
    }

    func carbonTabSwipeNavigation(carbonTabSwipeNavigation: CarbonTabSwipeNavigation, viewControllerAtIndex index: UInt) -> UIViewController {
        // return viewController at index
    }
}

CarbonSwipeRefresh

alt tag

示例代码

#import "CarbonKit.h"

@interface ViewController ()
{
	CarbonSwipeRefresh *refresh;
}
@end

@implementation ViewController
- (void)viewDidLoad {
	[super viewDidLoad];

	refresh = [[CarbonSwipeRefresh alloc] initWithScrollView:self.tableView];
	[refresh setColors:@[
		[UIColor blueColor],
	 	[UIColor redColor],
		[UIColor orangeColor],
		[UIColor greenColor]]
	]; // default tintColor

	// If your ViewController extends to UIViewController
	// else see below
	[self.view addSubview:refresh];

	[refresh addTarget:self action:@selector(refresh:) forControlEvents:UIControlEventValueChanged];
}

- (void)refresh:(id)sender {
	[refresh endRefreshing];
}
@end

如果您在使用UITableViewController,必须在viewDidAppear之后将refreshControl添加到self.view.superview中

- (void)viewDidAppear:(BOOL)animated {
	[super viewDidAppear:animated];

	if (!refreshControl.superview) {
		[self.view.superview addSubview:refreshControl];
	}
}

许可协议

MIT许可证(MIT)