• Stars
    star
    491
  • Rank 86,632 (Top 2 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created about 10 years ago
  • Updated almost 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A customizable popover-based UIActionSheet replacement for the iPhone & iPad

MTDActionSheet

A customizable UIActionSheet replacement for the iPad using blocks as callbacks.

In addition to the standard UIActionSheet functionality, fonts and colors of instances of MTDActionSheet can be easily customized and cells can show an additional accessory title. Moreover it is possible to disable certain buttons which can be useful if you use the actionSheet to let the user choose from a list of values and you want to show but disable the current selected value.

Screenshots

Screenshot with destructive tint color and accessory Screenshot with left-aligned buttons

Sample Usage

// customize the default appearance of action sheets
+ (void)customizeActionSheets {
    [MTDActionSheet setTitleFont:[UIFont systemFontOfSize:13.f]];
    [MTDActionSheet setButtonTitleFont:[UIFont lightRedditFontOfSize:21.f]];
    [MTDActionSheet setButtonAccessoryFont:[UIFont systemFontOfSize:19.f]];
    [MTDActionSheet setBackgroundColor:[UIColor MTDNavigationBarInPopoverBarTintColor]];
    [MTDActionSheet setSeparatorColor:[UIColor MTDLineColor]];
    [MTDActionSheet setTitleColor:[UIColor MTDActionSheetTitleColor]];
    [MTDActionSheet setTintColor:[UIColor MTDTintColor]];
    [MTDActionSheet setDestructiveTintColor:[UIColor MTDDestructiveTintColor]];
    [MTDActionSheet setDisabledTintColor:[UIColor MTDActionSheetTitleColor]];
    [MTDActionSheet setAccessoryTintColor:[UIColor MTDActionSheetAccessoryColor]];
    [MTDActionSheet setSelectionColor:[UIColor MTDMenuItemCellSelectionColor]];
}

- (void)showActionSheetAtRect:(CGRect)rect {
    MTDActionSheet *actionSheet = [[MTDActionSheet alloc] initWithTitle:@"Submissions from"];

    for (RDTListingSubtype subtype = RDTFirstListingSubtype; subtype <= RDTLastListingSubtype; subtype++) {
        NSString *title = NSStringFromRDTListingSubtype(subtype);
        NSString *accessoryTitle = (subtype == self.listingSubtype) ? @"βœ“" : nil;

        [actionSheet addButtonWithTitle:title accessoryTitle:accessoryTitle block:^(MTDActionSheet *sheet, NSInteger buttonIndex) {
            self.listingSubtype = subtype;
            self.subreddit.preferredListingSubtypeValue = subtype;
            [self reloadVisibleItemsShowingHUD:YES];
        }];

        if (subtype == self.listingSubtype) {
            [actionSheet disableButtonWithTitle:title];
        }
    }

    // customize the title color of only this instance
    actionSheet.titleColor = [UIColor blueColor];
    [actionSheet showFromRect:rect inView:self.view animated:YES];
}

Credits

MTDActionSheet was created by Matthias Tretter (@myell0w) and extracted from the beautiful reddit client Biscuit for reddit.

Biscuit for reddit

License

MTDActionSheet is available under the MIT license. See the LICENSE file for more info.

More Repositories

1

MTStatusBarOverlay

A custom iOS status bar overlay seen in Apps like Reeder, Evernote and Google Mobile App
Objective-C
1,926
star
2

MTLocation

A Framework to add convenience-stuff for easier coping with CoreLocation/MapKit on iOS. It includes a custom UIBarButtonItem mimicing the Locate-Me-Button of the built-in Google Maps App
Objective-C
341
star
3

MTDirectionsKit

Show directions directly on top of MKMapView
Objective-C
199
star
4

MTDURLPreview

Delight your users with simple URL previews for your iOS app
Objective-C
122
star
5

MTZoomWindow

A UIWindow that can be used to zoom in a specific UIView and displays it fullscreen
Objective-C
119
star
6

MTDirectionsKitDemo

Demo App demonstrating the use of MTDirectionsKit (mtdirectionsk.it)
Objective-C
98
star
7

MTSlideViewController

Just another take on Facebook's and Path's sliding navigation concept for iPhone
Objective-C
55
star
8

PageScrollView

A generic View that mimics Apple's homescreen-paging that supports both iPhone & iPad and rotation
Objective-C
41
star
9

MTInfoPanel

A clone of TweetBot's Notifications
Objective-C
27
star
10

AppleScripts

Some useful standalone Applescripts
AppleScript
23
star
11

Less-2-Do

ASE 06 Projekt - iPhone Todo App
Objective-C
20
star
12

LaunchBar-Actions

Some useful Applescripts for use as a LaunchBar (Quicksilver with slightly modifications) - Action
16
star
13

MTDLazyProperty

ObjC runtime playground: implementing memoized lazy evaluating properties with blocks
Objective-C
16
star
14

iOSAppTemplate

App Template for iOS using iOSKit and FoundationKit
Objective-C
12
star
15

MTHTTPFetcher

A Git-Clone of Matt Gallaghers' HTTP, XML and JSON Fetcher using JSONKit
Objective-C
10
star
16

TBXML-Encoded

A Fork of the lightweight TBXML Parser that directly parses encoded XML
Objective-C
9
star
17

Ghost-Runner

Prototype of an GPS Tracking System for Android
Java
6
star
18

AQGridViewAnimationSample

There's an animation-error, when rotating. Logic error or Bug in AQGridView?
Objective-C
5
star
19

XML-Parser

A sample XML Parser written in PostScript for University
Python
3
star
20

TU-SS11-PROGSPR-UE2-HASKELL

Haskell Project for Vienna University of Technology
Haskell
3
star
21

TU-SS11-HCI-LASTFM-SAMPLE

Objective-C
1
star
22

TU-WS12-MSWP

Vienna University of Technology - Management of Software Projects Group 12
1
star
23

MNCLogging

Simple Objective-C logging
Objective-C
1
star
24

Commander

A simple example of using Event Sourcing (https://martinfowler.com/eaaDev/EventSourcing.html)
Swift
1
star