Giter VIP home page Giter VIP logo

carbonkit's Introduction

alt tag

Carthage compatible CocoaPods compatible License: MIT

IMPORTANT NOTE: Please don't submit issues for questions regarding your code. Only actual bugs or feature requests will be answered, all others will be closed without comment. In case of reporting a bug, please include a screenshot and the code to reproduce it.

CarbonKit is an open source iOS library that includes powerful and beauty UI components.

CarbonKit includes:

  • CarbonSwipeRefresh
  • CarbonTabSwipeNavigation

Carthage

Add following line into your Cartfile

github "ermalkaleci/CarbonKit"

Run carthage update

CocoaPods

CarbonKit is available on CocoaPods. Add to your Podfile:

use_frameworks!
pod 'CarbonKit'

Run pod install

CarbonTabSwipeNavigation

alt tag

SAMPLE CODE

#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 Sample

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

SAMPLE CODE

#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

If you are using UITableViewController you must add the refreshControl into self.view.superview after viewDidAppear

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

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

LICENSE

The MIT License (MIT)

carbonkit's People

Contributors

emmavray avatar ermalkaleci avatar tstump-phunware avatar wanbok avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

carbonkit's Issues

CarbonKit in Swift

Selamlar Ermal Abi, thank you so much for the library, the functionality here is exactly what I was looking for. However, I am struggling to get it working in swift using the bridging file route. I have started by trying to create a very simple version of your example document to try and figure out where the issue is however this hasn't helped. Everything compiles and builds fine but the error is thrown during run time.

The code I am using is below and where the error is thrown is shown below. From what I can tell the line throwing the error is:
tabSwipe.createWithRootViewController(self, tabNames: names, tintColor: color, delegate: self)

Any help would be greatly appreciated. Thank you.

This is my code:
screen shot 2015-10-03 at 13 51 50

This is where the error is being thrown within the library:
screen shot 2015-10-03 at 13 54 10
screen shot 2015-10-03 at 13 54 37

Include with other controls in UIViewController

It looks not possible to use CarbonTabSwipeNavigation in an already UIViewController incase if we want to have a banner, header or simply any other UIView above Tabs. Its because CarbonTabSwipeNavigation inherits UIViewController which I believe restricts itself to be used as a part of some UIViewController beside other controls of UI instead it is a full fledge UIViewController.

Is there a way to use CarbonTabSwipeNavigation inside as a control in UIViewController? Like this:
05-1dashboard-accounts

CocoaPods

Using cocoapods, it doesn't install the version 2.0 but any other. When adding the version number to the podfile it spits an error.

Carbonkit targetview

did you remove targetview in the latest version?

  • (void)insertIntoRootViewController:(UIViewController *)rootViewController
    andTargetView:(UIView *)targetView;

I cant determine the targetview for more customization

ScrollView over my controller- not a bug-

Hello.
I'am quite new in developing and having fun discovering stuff . Was wondering if it is possible to have the scrollView over my content and not on top.

I put an image on top over the statusbar (got some pain with this bar sometimes) and want to have some transparancy on the scrollview in order to put it over my imageview(and not having the image view under the scroll view and having a white status bar)

for now, gonna try to overload (don't know if it is the correct word in swift) your code and maybe play with offset.
i guess I have to play with constraint... but not used to write it in the code :D

Thanks anyway

Crash when swiping away from a UITableViewController with an active UISearchController

As stated in the title. I have a single subclass of UITableViewController that I am instantiating multiple times (holding different subsets of data in each). I have a UISearchController initialized in the viewController, and the tableView.tableHeaderView is set as searchController.searchBar.

`
let searchController = UISearchController(searchResultsController: nil)

override func viewDidLoad() {
    super.viewDidLoad()

    // Set up the search bar
    searchController.searchResultsUpdater = self
    searchController.dimsBackgroundDuringPresentation = false
    searchController.hidesNavigationBarDuringPresentation = false

    definesPresentationContext = true
    tableView.tableHeaderView = searchController.searchBar
}

`

If I click into the search field and start searching, and then switch view controllers by swiping or clicking on a new one, I get a crash.

From the debugging output, it looks like there is an exception thrown:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unexpected subviews'

How Can I Add to Bottom

i want to add tab bar to bottom. How can i do this? Yani tab barı ekranın alt kısmına nasıl alırım? ;)

Crash when moving away

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An instance 0x14e86de00 of class UITableView was deallocated while key value observers were still registered with it. Current observation info: <NSKeyValueObservationInfo 0x170845ee0> ( <NSKeyValueObservance 0x1702cb130: Observer: 0x0, Key path: contentOffset, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x174245c70> <NSKeyValueObservance 0x1702d4900: Observer: 0x0, Key path: contentSize, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x170449780> <NSKeyValueObservance 0x1702caf70: Observer: 0x0, Key path: frame, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x17045d880> <NSKeyValueObservance 0x1702cb130: Observer: 0x0, Key path: contentOffset, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x174245c70> <NSKeyValueObservance 0x1702d4900: Observer: 0x0, Key path: contentSize, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x170449780> <NSKeyValueObservance 0x1702caf70: Observer: 0x0, Key path: frame, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x17045d880> )' *** First throw call stack: (0x1825bc2d8 0x193de00e4 0x1825bc218 0x183441810 0x10003edc4 0x193ddeb1c 0x193debf38 0x193debf90 0x18734391c 0x186ff9e50 0x187165cc4 0x10003be08 0x182499458 0x1824a5a18 0x193df9724 0x18249d074 0x182573e1c 0x182571828 0x18249d2d4 0x18bcb36fc 0x187062fac 0x10011067c 0x19445ea08) libc++abi.dylib: terminating with uncaught exception of type NSException

TabExtraWidth is applied multiple times

When setting TabExtraWidth, the extra width is applied multiple times (on each redraw) which causes the tabs to grow endlessly.

My suggestion:
On CarbonTabSwipeSegmentedControl.m:77 add a flag which indicates if the extra width has been added already.

Issue with RTL (iOS 9.x) (The indicator resizes to the tab Before next not after and More) ...

There's an issue when displaying the tabs in RTL, if you start swiping the library starts Highlighting the TAB on the other direction, and the indicator keeps resizing to the size of the tab opposite to the direction of swiping.

e.g.
In LTR:

|  VERY WIDE TAB 1 | TAB 2 | LONG TAB 3 |
                   --------                            

Swiping in this direction ------>

When swiping from TAB 2 to to TAB 3, the indicator keeps resizing to TAB 3's size until you lift your finger and it stops smoothly, also during the swipe TAB 3, keeps getting the highlighted color until it transitions completely.

now in RTL:

| LONG TAB 3 | TAB 2 | VERY WIDE TAB 1 |
             --------

<--------- Swiping in this direction

When Swiping again from TAB 2 to TAB3 the following happens:
1-While swiping the indicator keeps resizing to fit the width of "TAB 1" not TAB 3, and also TAB 1 keeps getting the highlight color,
2-Once you lift your finger the indicator corrects itself to the size of TAB3 and the highlight is set on TAB 3, (and this happens suddenly so it looks so flickering).

Load every tabs at once

Hi, I'd like to know if it's possible to load every tabs once, to navigate flawlessly between them (and not one by one when you switch them).
Thanks

pod

could you plz make it pod

How to disable the horizontal scrolling?

I want to disable the swiping so that the controllers can only be selected by tapping the tab titles. As one of my child view controllers is going to have a horizontal scrolling collection view.
Or is it going to be fine? Thanks

Swift 1.2 problem with array

I have a problem in Swift, my problem is with necessary array, i receive this error....

* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* setObjectForKey: object cannot be nil (key: 0)'

My code is this
var names = ["About Redar", "Privacy Policy", "Terms of Use"]
tabSwipe = CarbonTabSwipeNavigation()
tabSwipe.createWithRootViewController(self, tabNames: names, tintColor: UIColor.redColor(), delegate: self)
tabSwipe.setNormalColor(UIColor.whiteColor())
tabSwipe.setSelectedColor(UIColor.blueColor())

Somebody with the same error?

Custom navigationbar

Hello,

i face one issue when i hide navigationbar hidden and i create custom view of at top than i want to show your controller?

Thanks,
Mohsinali

Crash when moving away

Hello !
This happens when I move away from the controller containing the refresh control.

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** +[NSLayoutConstraint constraintWithItem:attribute:relatedBy:toItem:attribute:multiplier:constant:]: A multiplier of 0 or a nil second item together with a location for the first attribute creates an illegal constraint of a location equal to a constant. Location attributes must be specified in pairs' *** First throw call stack: (0x184ebc2d8 0x1966e00e4 0x184ebc218 0x185e9decc 0x185d25ad0 0x10017d14c 0x1898f82bc 0x1898f6e54 0x1898f9c20 0x184d99458 0x184da5a18 0x1966f9724 0x184d9d074 0x1898f079c 0x184e742a4 0x184e71230 0x184e71610 0x184d9d2d4 0x18e5b36fc 0x189962fac 0x100175390 0x196d5ea08) libc++abi.dylib: terminating with uncaught exception of type NSException

screenshot 2015-04-20 14 18 11

Retain Cycle in CarbonTabSwipeNavigation

Hi there,

It seems there is a retain cycle on line 61 of CarbonTabSwipeNavigation.m:

rootViewController = viewController;

Since rootViewController is an instance variable, which is strong by default, the child view controller is retaining the parent view controller.

An easy fix is to make the rootViewController instance variable weak on line 38:

__weak UIViewController *rootViewController;

This then allows the parent to dealloc correctly (e.g. when the root view controller is popped off the navigation stack).

Thanks a lot, and great library so far!

In width issue

Hello,

suppose i mutable array one records then run the project with latest source code does not reflect in full width. Please refer attach image

screen shot 2016-02-10 at 3 45 04 pm

Change tab bar width

Hi,

First of all, I want to say thanks for this tool.

My question is, how I can change script to have a segment like the attached screen.
segment

sgement_selected

Thanks

Slide/swipe animation when tab items are tapped.

I would like to know how we can obtain a slide/swipe animation between the views when a tab item is tapped on. As of now it simply changes the view without animation when tapped.
Please help me out with this.
Thanks in advance!

Wrong scroll animation when using setCurrentTabIndex:

I have 10 pages and want to allow the user to go to the next screen with a button. So I set the current index with the method:
[carbonTabSwipeNavigation setCurrentTabIndex:2];

But when I go from tab 1 to 2 the scroll animation is from right to left and not from left to right.

How to programmatically remove the swipe gestures

I'm building an application that uses navigation drawers on both sides, I would love to have the ability to remove the swipe gesture when I'm on the first and the last tabs, I'm using delegates to detect the slides but I would like to programmatically enable or disable the scrolling of the tabs

Is there any way to do this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.