• This repository has been archived on 05/Nov/2020
  • Stars
    star
    414
  • Rank 101,391 (Top 3 %)
  • Language
    Objective-C
  • License
    Other
  • Created over 10 years ago
  • Updated over 7 years ago

Reviews

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

Repository Details

Versatile solution for displaying widget menus. Easily adjustable with custom layouts and/or animations.

DLWidgetMenu No Maintenance Intended

DLWidgetMenu is a versatile solution for displaying widget menus and can easily be extended with custom layouts and/or animations.

Preview

screenshot

Features

DLWidgetMenu comes with three built-in layouts:

  • DLWMLinearLayout
  • DLWMRadialLayout
  • DLWMSpiralLayout

DLWidgetMenu uses iOS7's spring animations (DLWMSpringMenuAnimator) by default, but can easily be provided with your own custom animations as well (by subclassing DLWMMenuAnimator).

DLWidgetMenu observes its menu items for these gesture recognizer events:

  • single tap
  • double tap
  • long press
  • pan
  • pinch

and forwards them directly to its delegate.

None of these events make DLWidgetMenu do anything by default.
The menu (by default) doesn't even open, when you tap it!

And it shouldn't.

DLWidgetMenu was specifically designed to keep you in full control over its behaviour. All it does is animating and layouting its menu items. Keeping you in total charge of what to do and when.

Assuming you do want DLWidgetMenu to open when single-tapped, all you need to do is implement this in your DLWMMenuDelegate:

- (void)receivedSingleTap:(UITapGestureRecognizer *)recognizer onItem:(DLWMMenuItem *)item inMenu:(DLWMMenu *)menu {
	if ([menu isClosedOrClosing]) {
		[menu open];
	} else if ([menu isOpenedOrOpening]) {
		if (item == menu.mainItem) {
			[menu close];
		} else {
			[menu closeWithSpecialAnimator:[[DLWMSelectionMenuAnimator alloc] init] forItem:item];
		}
	}
}

As you can see the delegate makes DLWidgetMenu use a custom animator for the tapped menu item by calling:

[menu closeWithSpecialAnimator:[[DLWMSelectionMenuAnimator alloc] init] forItem:item];

(The built-in DLWMSelectionMenuAnimator applies a scale-up in combination with a fade-out.)

Don't want that? Fine, just call [menu close]; then.

Okay, tapping is pretty standard stuff, right? Nothing too fancy. So how about moving a menu around using a pan gesture? Piece of cake:

- (void)receivedPan:(UIPanGestureRecognizer *)recognizer onItem:(DLWMMenuItem *)item inMenu:(DLWMMenu *)menu {
	// NSLog(@"%s", __FUNCTION__);
	if (item == menu.mainItem) {
		[menu moveTo:[recognizer locationInView:menu.superview] animated:NO];
	}
}

It's worth mentioning here that one should usually prefer [menu moveTo:… animated:…]; over menu.center = …; (while the menu is open, that is).

The reason for this is that DLWidgetMenu shrinks to just wrap its main item when closed and stretches to fit its superview when opened (in order to catch tap events outside its menu items). Just enable the debugging-mode (menu.debuggingEnabled = YES;) and you should get an idea of what this means.

Installation

Just copy the files in "DLWidgetMenu/Classes/..." into your project.

Alternatively you can install DLWidgetMenu into your project with CocoaPods.
Just add it to your Podfile: pod 'DLWidgetMenu'

Demos

DLWidgetMenu contains a demo app giving you a quick overview of all three included layouts.

ARC

DLWidgetMenu uses automatic reference counting (ARC).

Dependencies

None.

Creator

Vincent Esche (@regexident)

License

DLWidgetMenu is available under a modified BSD-3 clause license with the additional requirement of attribution. See the LICENSE file for more info.

More Repositories

1

cargo-modules

Visualize/analyze a Rust crate's internal structure
Rust
723
star
2

Gestalt

An unintrusive & light-weight iOS app-theming library with support for animated theme switching.
Swift
324
star
3

DLAlertView

UIAlertView replacement that can embed custom content views, is fully themable and let's you use a delegate and/or blocks.
Objective-C
286
star
4

Pulsar

A versatile solution for displaying pulse animations as known from Apple Maps.
Swift
158
star
5

Rainbows

A Metal-backed, blazingly fast alternative to CAGradientLayer.
Swift
87
star
6

EventBus

A safe-by-default pure Swift alternative to Cocoa's `NSNotificationCenter`
Swift
76
star
7

swift-watch

Watches over your Swift project's source
Swift
47
star
8

DLConstraintLayout

Implementation of CAConstraint/CAConstraintLayoutManager for iOS that is compatible with equivalent OSX APIs.
Objective-C
37
star
9

Strategist

Algorithms for building strong immutable AIs for round-based games.
Swift
36
star
10

DLPDFRenderer

Lightweight solution for generating multi-page PDFs on iOS from arbitrary HTML input.
Objective-C
30
star
11

Sandbox

A simple to use yet versatile API for dealing with sandboxed file access.
Swift
25
star
12

AsyncOperation

A hassle-free implementation of asynchronous NSOperations/NSBlockOperations.
Swift
22
star
13

median

An implementation of an efficient O(n) median filter in Rust.
Rust
21
star
14

rust-seal

Rust implementation of Needleman-Wunsch & Smith-Waterman sequence alignment
Rust
18
star
15

Blues

A type-safe high-level wrapper around Core Bluetooth for iOS
Swift
17
star
16

apply_attr

A syntax extension providing higher-order attributes to Rust.
Rust
16
star
17

Forest

A collection of persistent immutable trees.
Swift
14
star
18

DLColorPicker

Modular color picker for iOS that uses no image resources for rendering
Objective-C
14
star
19

CollectionViewMultiColumnLayout

A tiled waterfal/mosaic UICollectionViewLayout with support for explicit columns.
Swift
13
star
20

XCConfig

XCConfig is a simple Swift implementation of a parser for ".xcconfig" files.
Swift
10
star
21

EnhancedRoundedRectangle

A reimplementation of SwiftUI's RoundedRectangle with support for non-uniform corner radii
Swift
5
star
22

Sync

Useful synchronization primitives in Swift
Swift
5
star
23

DLLog

NSLog-like logging API with support for level and context filtering.
Objective-C
3
star
24

SortedCollection

A sorted collection type for safely performing binary search operations in Swift
Swift
2
star
25

ScopedDefaults

Type-safe and structured UserDefaults in Swift
Swift
2
star
26

github-labels

Set of reasonable default labels and pleasant colors for GitHub projects
2
star
27

var_float

A universal representation of IEEE 754 floating-point numbers convertible between arbitrary precisions.
C++
2
star
28

tryexpand

Test harness for ui tests of macro expansion and its diagnostics
Rust
2
star
29

sitrep

Frontend-agnostic progress reporting for Rust
Rust
2
star
30

talks

Collection of tech-talks I've given over the last years
1
star
31

lasean

Latent Semantic Analysis (LSA) for Ruby.
Ruby
1
star
32

PseudoRandom

Implementations of pseudo-random number generators in Swift
Swift
1
star
33

Interner

Swift implementation of general-purpose interners for every use case
Swift
1
star
34

Captain

Type-safe iOS app routing/coordination
Swift
1
star