GitXplorerGitXplorer
b

HSImageSidebarView

public
279 stars
39 forks
4 issues

Commits

List of commits on branch master.
Unverified
4ab098f1ea86db2dbde427ccc3d77e7a2073888c

Shared scheme for Xcode Bots to use.

bbjhomer committed 11 years ago
Unverified
c98c3f6d84c8f950aeb733ff054159bb80c3327d

Merge pull request #10 from MartijnvanderWoude/fix-beyondboundsdragdrop

bbjhomer committed 11 years ago
Unverified
2f8b3d2dfccc18a8bcc3402e8e1b6376262bbb55

Fix typo in last commit

mmartijnvdwoude committed 12 years ago
Unverified
ef0e3d06ca6c0b70d526d9f6425512629fe91d85

Fix array beyond bounds error when dropping a single image back in

mmartijnvdwoude committed 12 years ago
Unverified
04ccc9f43e0e28a1bd15b48798362ddb6d5d2ff7

Convert to ARC!

bbjhomer committed 13 years ago
Unverified
e4130792cb20c8eb26d83ff14fb6eafcf59bb9b3

Repo reorganization to keep things cleaner.

bbjhomer committed 13 years ago

README

The README file for this repository.

HSImageSidebarView

HSImageSidebarView is a subclass of UIView for displaying a collection of images. The images are arranged either horizontally or vertically, depending on the dimensions of the view. It supports selection, scrolling, drag-and-drop rearranging, and drag-and-drop deletion. The API is patterned after UITableView, so it will be familiar to Cocoa Touch programmers. HSImageSidebarView works with both iPad and iPhone interface idioms.

Sample screenshot

An HSImageSidebarView is created using the standard initWithFrame: method on UIView.

// Create an 80-pixel sidebar on the left side of the screen
HSImageSidebarView *sidebar = [[HSImageSidebarView alloc] initWithFrame:CGRectMake(0, 0, 80, 1004)];
sidebar.delegate = self;

[parentView addSubview:sidebar];

[sidebar release];

It can also be created in Interface Builder by adding a UIView and then setting its class (in IB) to HSImageSidebarView.

The image sidebar receives all its information through delegate methods. The two required methods are these:

- (NSUInteger)countOfImagesInSidebar:(HSImageSidebarView *)sidebar;
- (UIImage *)sidebar:(HSImageSidebarView *)sidebar imageForIndex:(NSUInteger)anIndex;

When a user taps, moves, or deletes an image, the delegate can be notified through one of these methods:

- (void)sidebar:(HSImageSidebarView *)sidebar didTapImageAtIndex:(NSUInteger)anIndex;
- (void)sidebar:(HSImageSidebarView *)sidebar didMoveImageAtIndex:(NSUInteger)oldIndex toIndex:(NSUInteger)newIndex;
- (void)sidebar:(HSImageSidebarView *)sidebar didRemoveImageAtIndex:(NSUInteger)anIndex;

HSImageSidebarView requires iOS 4.0 or later. A sample project is included to demonstrate usage.

To Do

The following are features which I would like to see added, but which haven't been completed yet:

  • Expose selection color property
  • Enable/disable drag-to-move
  • Enable/disable drag-to-delete
  • Be smarter about calculating the image frame when the the aspect fit doesn't fill the whole frame. (This mostly applies when trying to position a popover correctly.)
  • Add support for indentation levels
  • Add support for numbering images
  • Add support for multiple selection