• Stars
    star
    339
  • Rank 124,632 (Top 3 %)
  • Language
    Objective-C
  • License
    Other
  • Created over 11 years ago
  • Updated almost 4 years ago

Reviews

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

Repository Details

A UIView to handle entering recipients similar to iOS Mail

TURecipientBar

Version Carthage compatible License Platform

TURecipientBar is a UIView for entering recipients similarly to the iOS Mail app. It handles search and display of recipients.

Screenshot

Installation

CocoaPods

  1. Add pod TURecipientBar, '~> 2.0' to your Podfile.
  2. Run 'pod install'
  3. Import TURecipientsBar.h and TURecipientsDisplayController.h.

Manual

  1. Copy the TURecipientBar subfolder into your project.
  2. The only required framework is UIKit and iOS 6.0.
  3. Import TURecipientsBar.h and TURecipientsDisplayController.h.

Usage

See the included example project and the documentation.

TURecipientBar uses auto layout. This means that you will need to add constraints to it to position it. It will update it's height constraint automatically, and if you have your constraints setup properly, everything will adjust as needed.

Typically this means adding a constraint to the top, left, right and bottom of the bar. The bottom constraint will usually be a vertical spacing to another view.

If you are laying out your views in Interface Builder, you will be forced to add constraints to make the layout non ambiguous. In this case, you can add a height constraint with a priority lower than 1000 (so that it isn't required) and connecting the heightConstraint IBOutlet. In Xcode 5, you can now specify constraints as placeholders that will be removed a build time. Or, you can leave it off completely, but this will generate warnings.

For searching, you will need to create an instance of TURecipientsDisplayController. This class handles the logic of searching and displaying the search results. You then implement a UITableViewDataSource to show the search results and override composeDisplayController:shouldReloadTableForSearchString: to update the search results.

You need to connect the following outlets of the TURecipientsDisplayController:

  • recipientsBar: The TURecipientsBar.
  • contentsController: The view controller that the search results will be placed in. Almost always the view controller that the recipientsBar is in.
  • searchResultsDataSource: The data source for the search table view.
  • searchResultsDelegate: The delegate for the search table view. Usually the same as searchResultsDataSource.
  • recipientsBar.delegate: Connect the recipientsBar's delegate to the TURecipientsDisplayController.

You will also need to keep a reference to TURecipientsDisplayController or it will be deallocated.

For iOS 7, you will need to set automaticallyAdjustsScrollViewInsets = NO for the view controller the recipient bar is in. If you don't, it will cause the recipient bar (which is a subclass of UIScrollView) to behave erratically. I am looking into these issues to remove this requirement, and this may actually be a bug in iOS 7.

Customization

Hide the add button:

self.recipientsBar.showsAddButton = NO;

Add placeholder text:

self.recipientsBar.placeholder = NSLocalizedString(@"Type names...", nil);

Change the label's text:

self.recipientsBar.label = @"Invite:";

Disable search table view:

- (BOOL)recipientsDisplayControllerShouldBeginSearch:(TURecipientDisplayController *)controller
{
	return NO;
}

Change recipients appearance:

UIImage *backgroundImage = [[UIImage imageNamed:@"token"] stretchableImageWithLeftCapWidth:14.0 topCapHeight:0.0];
[[TURecipientsBar appearance] setRecipientBackgroundImage:backgroundImage forState:UIControlStateNormal];
NSDictionary *attributes = @{
                             NSFontAttributeName: [UIFont fontWithName:@"American Typewriter" size:14.0],
                             NSForegroundColorAttributeName: [UIColor yellowColor],
                             };
[[TURecipientsBar appearance] setRecipientTitleTextAttributes:attributes forState:UIControlStateNormal];

Change label appearance

NSDictionary *labelAttributes = @{
                                  NSFontAttributeName: [UIFont fontWithName:@"Marker Felt" size:14.0],
                                  NSForegroundColorAttributeName: [UIColor redColor],
                                  };
[[TURecipientsBar appearance] setLabelTextAttributes:labelAttributes];

More Repositories

1

TUSafariActivity

A UIActivity subclass that opens URLs in Safari
Objective-C
312
star
2

CacheKit

Simple and flexible caching mechanism for in memory and persistent caches.
Objective-C
191
star
3

iPhone-Simulator-Capture

Records video screen captures of the iPhone simulator
Objective-C
120
star
4

ImageIOSwift

Swift wrapper around ImageIO
Swift
111
star
5

swift-glob

A native Swift implementation of glob match patterns.
Swift
45
star
6

MultipartForm

The missing multipart form support for URLSession.
Swift
44
star
7

PG.swift

A PostgreSQL client library written in pure Swift (without any dependency the C libpq).
Objective-C
42
star
8

graphile-scheduler

Job scheduling for PostgreSQL running on Node.js built on top of graphile-worker. It’s like cron, but reliable and distributed.
TypeScript
39
star
9

TULayoutAdditions

Shortcuts and helper methods for iOS Auto Layout
Objective-C
26
star
10

TNKImagePickerController

A replacement for UIImagePickerController that can select multiple photos.
Objective-C
24
star
11

TNKRefreshControl

A replacement for UIRefreshControl with a more modern look and more flexibility
Objective-C
20
star
12

SimpleInstapaperKit

An iOS interface for the Instapaper Simple API (http://www.instapaper.com/api/simple)
Objective-C
11
star
13

RefreshTintFail

UIRefreshControl tintColor is not applied on initial refresh
Objective-C
9
star
14

plaza-ios

An iOS App to view public topics, events, needs, prayers and albums from On The City Plaza.
Objective-C
8
star
15

TULogging

Better logging that uses ASL log levels. Based on work by Mike Weller.
Objective-C
7
star
16

PersistentCacheKit

A Swift package for caching items to the filesystem (using SQLite by default).
Swift
7
star
17

UntitledTerminalApp

Swift
6
star
18

DBF-Reader

A simple dbf editor for Mac.
C
5
star
19

version_bot

A simple service to keep track of build numbers.
Ruby
3
star
20

iphone-icon-tester

Preview your iPhone icons natively.
PHP
2
star
21

TNKFoundation

A collection of small utilities in Swift.
Swift
2
star
22

AsyncKit

Swift
2
star
23

GoogleVoiceBrowser

A simple dedicated browser window for Google Voice
Objective-C
2
star
24

LoginExample

An example of how to create a login flow for iOS. See https://www.davidbeck.co/blog/2018/08/03/login-app-flow.html.html
Swift
2
star
25

RoutesExample

Example app of how to use url based navigation for an iOS app. For more information see https://www.davidbeck.co/blog/2018/08/17/route-base-navigation.html.html
Swift
2
star
26

TNKData

A replacement for Core Data with a focus on control, performance and concurrency
Objective-C
1
star
27

CacheExample

Example code to demonstrate a bug in NSURLCache
Objective-C
1
star
28

davbeck.github.io

Static site for davidbeck.co
SCSS
1
star
29

VectorIO

Swift
1
star
30

deploy_hook

Automatically run a deploy script when changes are pushed to Github.
JavaScript
1
star
31

aws-lambda-swift-hook

A Swift module to facilitate running Swift on Lambda using a node bootstrap.
Swift
1
star
32

GIFFun

A sample project demonstrating how to support animated GIFs.
Swift
1
star
33

versionbotclient

Go
1
star
34

sawdust.fun

SCSS
1
star
35

monkey_proxy

A proxy server that records and replays http requests.
JavaScript
1
star
36

xcassetsenum

Convert an Xcode xcassets catalog file into a Swift enum for type safe compiler checked image assets.
Go
1
star
37

radars

Various bug reports sent to Apple with sample code
1
star
38

SwiftRecord

Object-relational mapping in Swift
Swift
1
star
39

TUMessagePackSerialization

MessagePack serializer for Objective-C and Swift
Objective-C
1
star
40

chipins

A Wordpress plugin that adds a short code to show giving progress.
PHP
1
star
41

cdmodeltoswift

Custom Swift codegen for Core Data models.
Swift
1
star
42

SyphonToHLS

A simple app that converts Syphon streams to HLS
Objective-C
1
star