All Projects → phranck → Ccnstatusitem

phranck / Ccnstatusitem

Licence: mit
CCNStatusItem is a subclass of NSObject to act as a custom view for NSStatusItem. It supports a customizable statusItemWindow handling any viewController for presenting the content.

Projects that are alternatives of or similar to Ccnstatusitem

Ftpopovermenu
FTPopOverMenu is a pop over menu for iOS which is maybe the easiest one to use. Supports both portrait and landscape. It can show from any UIView, any UIBarButtonItem and any CGRect.
Stars: ✭ 988 (+343.05%)
Mutual labels:  cocoapods, popover
Pmcalendar
Yet another calendar component for iOS. Compatible with iOS 4.0 (iPhone & iPad) and higher. Supports presenting as a popover and very flexible UI tuning. Default theme is inspired by https://github.com/ocrickard/OCCalendar
Stars: ✭ 383 (+71.75%)
Mutual labels:  cocoapods, popover
Popover
Custom macOS Popover 💬
Stars: ✭ 71 (-68.16%)
Mutual labels:  statusbar, popover
Sheeeeeeeeet
Sheeeeeeeeet is a Swift library for creating menus, custom action sheets, context menus etc.
Stars: ✭ 1,177 (+427.8%)
Mutual labels:  cocoapods, popover
Aksidemenu
Beautiful iOS side menu library with parallax effect. Written in Swift
Stars: ✭ 216 (-3.14%)
Mutual labels:  cocoapods
Dtphotoviewercontroller
A fully customizable photo viewer ViewController to display single photo or collection of photos, inspired by Facebook photo viewer.
Stars: ✭ 212 (-4.93%)
Mutual labels:  cocoapods
Ember Tooltips
Easy and extendible tooltips for Ember components - http://sir-dunxalot.github.io/ember-tooltips/
Stars: ✭ 205 (-8.07%)
Mutual labels:  popover
Swiftdailyapi
A Swift API framework for ZhiHu's Daily News.
Stars: ✭ 204 (-8.52%)
Mutual labels:  cocoapods
Privacypermission
[DEPRECATED!!]PrivacyPermission is a library for accessing various system privacy permissions
Stars: ✭ 222 (-0.45%)
Mutual labels:  cocoapods
Amplitude Ios
Native iOS/tvOS/macOS SDK
Stars: ✭ 216 (-3.14%)
Mutual labels:  cocoapods
Helipopper
🚁 A Powerful Tooltip and Popover for Angular Applications
Stars: ✭ 215 (-3.59%)
Mutual labels:  popover
Spstorkcontroller
Now playing controller from Apple Music, Mail & Podcasts Apple's apps.
Stars: ✭ 2,494 (+1018.39%)
Mutual labels:  popover
Pincache
Fast, non-deadlocking parallel object cache for iOS, tvOS and OS X
Stars: ✭ 2,513 (+1026.91%)
Mutual labels:  cocoapods
Shsearchbar
The search bar that doesn't suck.
Stars: ✭ 206 (-7.62%)
Mutual labels:  cocoapods
Expandedtabbar
ExpandedTabBar is a very creative designed solution for "more" items in UITabBarController. It's greate experience to have more comfortable and intuitive UI.
Stars: ✭ 219 (-1.79%)
Mutual labels:  cocoapods
Cocoapods
The Cocoa Dependency Manager.
Stars: ✭ 13,503 (+5955.16%)
Mutual labels:  cocoapods
Sbtuitesttunnel
Enable network mocks and more in UI Tests
Stars: ✭ 215 (-3.59%)
Mutual labels:  cocoapods
Infinitecollectionview
Infinite horizontal scrolling using UICollectionView.
Stars: ✭ 218 (-2.24%)
Mutual labels:  cocoapods
Theanimation
Type-safe CAAnimation wrapper. It makes preventing to set wrong type values.
Stars: ✭ 214 (-4.04%)
Mutual labels:  cocoapods
Statusbaralert
Telegram X inspired android status bar alert view
Stars: ✭ 214 (-4.04%)
Mutual labels:  statusbar

Flattr this git repo Travis Status

Overview

CCNStatusItem is a subclass of NSObject to act as a custom NSStatusItem. Running on Yosemite it has full support for the class NSStatusBarButton which is provided by NSStatusItem via the button property.

Features:

  • Yosemite's dark menu mode will be automatically handled
  • Proximity drag detection
  • Support for Drag&Drop
  • Custom Views as StatusItems
  • Support for switching the StatusItem on/off (in case you're using both the StatusItem and a Dock Icon)

It supports a customizable statusItemWindow that will manage any NSViewController instance for presenting the content.

This screenshot presents the current example application:

CCNStatusItem Example Application

Integration

You can add CCNStatusItem by using CocoaPods. Just add this line to your Podfile:

pod 'CCNStatusItem'

Usage

After it's integrated into your project you are just a few lines of code away from your (maybe) first NSStatusItem with a custom view and a beautiful looking popover window. A good place to add these lines of code is your AppDelegate:

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
   ...
    [[CCNStatusItem sharedInstance] presentStatusItemWithImage:[NSImage imageNamed:@"statusbar-icon"]
                                         contentViewController:[ContentViewController viewController]];
   ...
}

That's all! You will have some options to change the design of this statusItem popover window using CCNStatusItemWindowConfiguration. In the example above internally CCNStatusItem uses [CCNStatusItemWindowConfiguration defaultConfiguration] to set a default design and behavior of the status bar popover window. The next example will show you how to change this design and behaviour:

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
    ...
    
    // configure the status item
    CCNStatusItem *sharedItem = [CCNStatusItem sharedInstance];
    sharedItem.windowConfiguration.presentationTransition = CCNPresentationTransitionSlideAndFade;
    sharedItem.proximityDragDetectionHandler = ^(CCNStatusItem *item, NSPoint eventLocation, CCNStatusItemProximityDragStatus dragStatus) {
        switch (dragStatus) {
            case CCNProximityDragStatusEntered:
                [item showStatusItemWindow];
                break;

            case CCNProximityDragStatusExited:
                [item dismissStatusItemWindow];
                break;
        }
    };
    [sharedItem presentStatusItemWithImage:[NSImage imageNamed:@"statusbar-icon"]
                     contentViewController:[ContentViewController viewController]];
    ...
}

Some Side Notes

The statusItem popover's frame size will be determined automatically by calling preferedContentSize on the contentViewController. So you shouldn't forget to set it to a reasonable value. Using XIB's for building the content a good way to do so is returning:

- (CGSize)preferredContentSize {
    return self.view.frame.size;
}

Requirements

CCNStatusItem has been written using ARC and "modern" Objective-C 2. It supports OS X 10.10 Yosemite and above.

Contribution

The code is provided as-is, and it is far off being complete or free of bugs. If you like this component feel free to support it. Make changes related to your needs, extend it or just use it in your own project. Pull-Requests and Feedbacks are very welcome. Just contact me at [[email protected]](mailto:[email protected]?Subject=[CCNStatusItem] Your component on Github) or send me a ping on Twitter @TheCocoaNaut.

Documentation

The complete documentation you will find on CocoaDocs.

License

This software is published under the MIT License.

Software that uses CCNStatusItem

  • Review Times - A small Mac tool that shows you the calculated average of the review times for both the Mac App Store and the iOS App Store
  • SalesX - SalesX is the simplest way to reach your iTC sales reports
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].