Coder Social home page Coder Social logo

mmspreadsheetview's Introduction

#Mutual Mobile Spreadsheet View MMSpreadsheetView is a configurable spreadsheet-like view. Depending on the initial header row or column configuration, up to four collection views will be coordinated to provide the user interface. Although originally designed for use on iPad in full-screen, it scales down well for use in smaller views.


##Documentation Official appledoc documentation can be found at CocoaDocs.


##Installing MMSpreadsheetView Badge w/ Version Badge w/ Platform You can install MMSpreadsheetView in your project by using CocoaPods:

pod 'MMSpreadsheetView', '~> 0.0.3'

##Initializing a Spreadsheet View The designated initializer for MMSpreadsheetView requires passing in the number of header rows and columns as well as the initial bounds rect. Register the cell classes you will be using and set the delegate and dataSource. Finally, add the view as a subview.

// Create the spreadsheet in code.
MMSpreadsheetView *spreadSheetView = [[MMSpreadsheetView alloc] initWithNumberOfHeaderRows:1 numberOfHeaderColumns:1 frame:self.view.bounds];

// Register your cell classes.
[spreadSheetView registerCellClass:[MMGridCell class] forCellWithReuseIdentifier:@"GridCell"];
[spreadSheetView registerCellClass:[MMTopRowCell class] forCellWithReuseIdentifier:@"TopRowCell"];
[spreadSheetView registerCellClass:[MMLeftColumnCell class] forCellWithReuseIdentifier:@"LeftColumnCell"];

// Set the delegate & datasource spreadsheet view.
spreadSheetView.delegate = self;
spreadSheetView.dataSource = self;

// Add the spreadsheet view as a subview.
[self.view addSubview:spreadSheetView];
self.spreadSheetView = spreadSheetView;

##Caveats

  • Performance: As the number of cells shown increases, scrolling performance declines. A large grid (1000x1000) takes a long time to initialize, but if the cell sizes are large enough (150x150) or greater, scrolling performance is not affected. However, a small grid (50x50) of (20x20) cells basically doesn't scroll.
  • NSIndexPath convenience category: The library includes a convenience category for NSIndexPath to reduce confusion. The additions of indexPath.mmSpreadsheetRow and indexPath.mmSpreadsheetColumn represent their respective elements.
  • CollectionView pass-through methods: The following methods provide support for copy/paste actions on cells. All three should be implemented if any are.
    1. spreadsheetView:shouldShowMenuForItemAtIndexPath:
    2. spreadsheetView:canPerformAction:forItemAtIndexPath:withSender:
    3. spreadsheetView:performAction:forItemAtIndexPath:withSender:

  • Unintended gesture handling: MMSpreadsheetView hooks into the collection view pan gesture recognizers to implement "exclusive touch," which disables tap registration on other sections of the grid until the first touch ends. Also, touches are disabled when the view is in a bounce to prevent locking the view in an awkward state.

##Credit Designed and Developed by these fine folks at Mutual Mobile:

###Development


##Feedback We'd love to hear feedback on the library. Create Github issues, or hit us up on Twitter.


##License License MIT MMSpreadsheetView is available under the MIT license. See the LICENSE file for more info.

mmspreadsheetview's People

Contributors

jeffla avatar kcharwood avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mmspreadsheetview's Issues

index 0,0 never being called for cell creation

I have been struggling with this for a while, but since I moved my project into Xcode 6 gm, I have been having trouble that no cells for the collection view with tag '1' are being initialised (Top left collection view). I have also downloaded he demo project and compiled it in Xcode 6, and the top left cell appears correctly. My initialisation code for the spreadsheet is nearly identical, with the only difference being the size. I have also checked that the collection view is being created, which it is, however the cell is not. Any advice or ideas why this error night be occurring?

Reset scrolling programmatically

I apply filter on button tap. So in this case I want reset scroll position to initial one. Please let me know, how could I do that programmatically.
Thanks!

Weird alignment when set no bouncing

I do not want the sheet to bouncing so I added this to your example in viewDidLoad after allocation.

[spreadSheetView setBounces:NO];

But after that when I scroll both lower left and upper right collection view at one time, it's end up wrong alignment.

ios simulator screen shot dec 27 2013 11 27 57 am

Stop scrolling

In your example : when you scroll the bottom right CollectionView, a touch on the bottom left CollectionView (and vice versa) does not stop the scrolling of these two CollectionViews. Only the CollectionView that is causing the scroll can stop scrolling of the two CollectionViews.
Is it possible to fix this ?

(sorry for my english)

I read your caveat : "Unintended gesture handling: MMSpreadsheetView hooks into the collection view pan gesture recognizers to implement "exclusive touch," which disables tap registration on other sections of the grid until the first touch ends. Also, touches are disabled when the view is in a bounce to prevent locking the view in an awkward state.".

One big issue: why I didn't found this source much earlier ?

Hello MutalMobile,

This is a very nice piece of software you shared with us. Very simple to implement and enhance. I will used it in my 3rd upgrade of my Folding app for iOS to replace an HTML webview based grid.

Still some work to do on my side to connect to CoreData and the width patch. But overall it runs very well.

Thank you very much !
ChristianVirtual

NSIndexPath+MMSpreadsheetView.h and m

I am using Swift 1.1 and I am bridging the classes.

  • (NSInteger)mmSpreadsheetRow {
    return self.section
    }
    The section above generates an error such as:
    Property 'section' not found on object of type NSIndexPath
  • (NSInteger)mmSpreadsheetColumn {
    return self.row;
    }
    The section above generates an error such as:
    Property 'row' not found on object of type NSIndexPath

It is worth to disable bouncing

- (UICollectionView *)setupCollectionViewWithGridLayout {
    MMGridLayout *layout = [[MMGridLayout alloc] init];
    UICollectionView *collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
// Add the following line
    collectionView.bounces = NO;
    return collectionView;
}

exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN

First thing first I wanna say thank you for making this library, this is really a great work.

But unfortunately I just found an issue. I made a 3-header-rows and 1-header-column table and sometimes when I ran my project, it becomes crash with following error:

2015-02-12 12:35:23.981 mommychi[578:121987] *** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [2.5 nan]'
*** First throw call stack:
(0x2b7ac5f7 0x392fac77 0x2b7ac53d 0x2e6721cf 0x2e6720d3 0x2e672065 0x2ec4afe3 0x1c48dd 0x1c2b69 0x2ec4e19f 0x2e679f65 0x2e675951 0x2e6757d9 0x2e6751c7 0x2e674fd1 0x2e66eedd 0x2b773015 0x2b7706f9 0x2b770afb 0x2b6bdb31 0x2b6bd943 0x32a72051 0x2ecaff21 0x59ef5 0x39896aaf)
libc++abi.dylib: terminating with uncaught exception of type NSException

Recently I realized that the error comes from MMSpreadsheetView.m, particularly at this line:

CGFloat indicatorOffsetY = collectionView.contentOffset.y / (contentSize.height - collectionViewFrame.size.height) * (scrollIndicator.frame.size.height - indicatorHeight);

The problem is (contentSize.height - collectionViewFrame.size.height) comes to zero.

Then I edited that line to:
CGFloat divider = (contentSize.height - collectionViewFrame.size.height > 0) ? (contentSize.height - collectionViewFrame.size.height) : 0.1;
CGFloat indicatorOffsetY = collectionView.contentOffset.y / divider * (scrollIndicator.frame.size.height - indicatorHeight);

I don't really understand what have I edited, but it become works, the error's gone.
Can you enlighten me about this issue? I hope there will be no another problem.

Example not working properly

Hi in the example when you run it on iOS7 Xcode 5.1.1 in the iPad simulator the first row which is R0:C1 etc text label values that entire row is missing and buried underneath the header row. It cannot be scrolled to. I have adjusted my code for this and I can see the first row below the header row. However another problem in scrolling is that the last row can be seen to be there when you scroll but it bounces one row above it and stops and is also partially showing that second to last row data. Please fix or tell me how scrolling is working because I couldn't figure this out.

Grid lines improvements

It would be nice to have a property that would set the width of the grid lines.
Also setting the color of the grid by changing the control's background is misleading. It would be nice to have a separate property for this.

Can't set size of cells

Is it possible to set different width for different columns?

As far as I investigated the method spreadsheetView: sizeForItemAtIndexPath: is not being call for every cell.

Cells are being overwritten in the screen while scrolling V or H

Alright, to start, would like to say this library is a good job and help me a lot as a solution for presenting spreadsheets. Second, would like to know how to solve this issue:

I've made some customization for populate the content within the spreadsheet. But while scrolling, the cells are being drawn above each other, out of order, producing a great mess in the screen.

It goes like this:
screen shot 2015-03-04 at 5 52 56 pm

But when I scroll H or V:
screen shot 2015-03-04 at 5 55 11 pm

Would like to have (please) some clarification about it.

Thanks in advance

Bounces

Hi Jeff,

Great job !
How, in your example, allow vertical bounces and disable horizontal bounces ?
What changes should be made in your code to allow this?

Thanks :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.