Coder Social home page Coder Social logo

easytableview's Introduction

FOSSA Status Language CocoaPods CocoaPodsDL

EasyTableView 2.1 - May 1, 2017

The API for EasyTableView has been extended. Swiping a table view cell in a perpendicular direction to the normal scrolling direction of an EasyTableView, drags the cell out of the EasyTableView. If touches end with the cell away from the EasyTableView it will be deleted. Otherwise it will animate back to it's normal position. See EasyTableViewController for an example.

EasyTableView 2.0 - January 7, 2016

IMPORTANT NOTE: The API for EasyTableView has changed of January 6, 2016. So if you have been a consumer of EasyTableView prior to this date, you may find that this update breaks your existing projects.

###SUMMARY

This project demonstrates the use of the EasyTableView class. The demo is intended to be run on an iPad only, but there is no reason why EasyTableView could not be used on an iPhone.

To use EasyTableView in your own project, all you need to include are the following files:

EasyTableView.h
EasyTableView.m

This was written before UICollectionView became available, but developers may still prefer to use EasyTableView for it’s simplicity.

###DESCRIPTION

EasyTableView was created to address two concerns. The first is the ability to have a table view, horizontal or vertical, that only partially fills the screen. Normally one would use UITableViewController but as per Apple documentation, that requires table views that fill the whole screen. EasyTableView addresses this problem by acting as the controller for the embedded table view, and exposes a subset of table view functionality with it's own delegate methods.

The second concern addressed by EasyTableView is horizontal table views. Table views were initially designed to be vertical only. EasyTableView solves this problem by rotating the table view, and then reverse rotating table view cells. One could also provide horizontally scrolling table views by subclassing UIScrollView, but I wanted to create one simple, common interface for creating both vertical EasyTableViews and horizontal EasyTableViews.

So now you can create simple partial-screen table views, either vertically or horizontally, all with the same interface.

###USAGE

To understand how to use EasyTableView, study the code in EasyTableViewController.m. To create a new EasyTableView object, look at the methods:

- (void)setupHorizontalView;
- (void)setupVerticalView;

Create a vertical scrolling table view with:

`

  • (id)initWithFrame:(CGRect)frame ofHeight:(CGFloat)cellHeight; `

To create a new horizontal scrolling table view use:

`

  • (id)initWithFrame:(CGRect)frame ofWidth:(CGFloat)cellWidth; `

For even simpler setup, look to see how to use EasyTableView with a storyboard in FlipsideViewController.m

There are only two delegate methods that must be implemented as part of the EasyTableViewDelegate protocol:

- (NSInteger)easyTableView:(EasyTableView *)easyTableView numberOfRowsInSection:(NSInteger)section
- (UITableViewCell *)easyTableView:(EasyTableView *)easyTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

If you plan to setup an EasyTableView with multiple sections, you must implement the following delegate method:

- (NSUInteger)numberOfSectionsInEasyTableView:(EasyTableView*)easyTableView;

That's all there is to it. It is very easy to use. And yes, that is a picture of my tent!

###KNOWN LIMITATIONS

  1. A horizontal EasyTableView will correctly auto-resize it's overall length. However a horizontal EasyTableView will NOT necessarily correctly auto-resize it's height.

  2. Loading the Flickr catalog will sometimes fail due to JSON parsing errors.

  3. Auto-layout is not supported.

###LICENSE

EasyTableView is released under the New BSD License.

Copyright (c) 2010-2017, Yodel Code LLC All rights reserved.

FOSSA Status

easytableview's People

Contributors

alekseyn avatar brandoncopley avatar fossabot avatar foxling avatar medhinou avatar sahasd avatar testower avatar vtim 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

easytableview's Issues

reloadData not working?

Hi, I'm using EasyTableView in my project and loving it. However, I've run into an issue and I'm not sure if it's my code or EasyTableView, so I thought I'd ask.

In my code, based on a user selection, I'm switching out the delegate for EasyTableView and calling [easyTableView.tableView reloadData] directly so that it hits up the new delegate with a new data set. Unfortunately, when I do this, the delegate methods are not getting called. I also jumped into the EasyTableView code attempting to debug, but the UITableView delegate methods you implement on EasyTableView aren't getting called either. I just wanted to check with you to see if this was a design constraint of EasyTableView or if I was perhaps mis-using it somehow. Any help is greatly appreciated!

Problem with bouncing

If you embed EasyTable as a subview to a UIScrollView the left bouncing is broken.
So if you want to build Pulse like UI it's not a good idea to use this component.

Vertically Resizing a Horizontal EasyTable

Hi

I have a Horizontal EasyTable bar added to the bottom of my view. The calendar control at the top of the view can resize in certain situations and I'd like the EasyTable to resize too.

I've gone round adding resizesSubviews to everything I can find but still when the cal control grows, the top of the cells in my EasyTable become hidden by the other control (despite the AutoResizeMasks on the EasyTable being set).

Do you have any idea how to make the cells resize when the EasyTable is resized like this?

Many thanks

Sections

Alright why couldn't we implement headers and footers? I believe I have added headers and footers and done a great implementation.

Can I share this code?

-(UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
if ([delegate respondsToSelector:@selector(easyTableView:viewForHeaderInSection:)]) {
return [delegate easyTableView:self viewForHeaderInSection:section];
}
return [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
}

-(UIView*)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{

if ([delegate respondsToSelector:@selector(easyTableView:viewForFooterInSection:)]) {
    return [delegate easyTableView:self viewForFooterInSection:section];
}
return [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];

}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{

if ([delegate respondsToSelector:@selector(numberOfSectionsInEasyTableView::)]) {
    return [delegate numberOfSectionsInEasyTableView:self];
}

return 1;

}

  • (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    NSUInteger numOfItems = _numItems;

    if ([delegate respondsToSelector:@selector(numberOfCellsForEasyTableView:inSection:)]) {
    numOfItems = [delegate numberOfCellsForEasyTableView:self inSection:section];

    // Animate any changes in the number of items
    [tableView beginUpdates];
    [tableView endUpdates];
    

    }

    return numOfItems;
    }

  • (UIView *)viewAtIndex:(NSUInteger)index inSection:(NSInteger)section{
    NSIndexPath *indexPath = [NSIndexPath indexPathForRow:index inSection:section];
    UIView *cell = [self.tableView cellForRowAtIndexPath:indexPath];

    return [cell viewWithTag:CELL_CONTENT_TAG];
    }

in the .h

  • (NSUInteger)numberOfCellsForEasyTableView:(EasyTableView *)view inSection:(NSInteger)section;
  • (NSUInteger)numberOfSectionsInEasyTableView:(EasyTableView*)easyTableView;
  • (UIView_)easyTableView:(EasyTableView_)easyTableView viewForHeaderInSection:(NSInteger)section;
  • (UIView_)easyTableView:(EasyTableView_)easyTableView viewForFooterInSection:(NSInteger)section;
  • (UIView *)viewAtIndex:(NSUInteger)index inSection:(NSInteger)section;

This seems to work swimmingly.

Crash on 3.2

This view currently causes a crash on 3.2 because of the following lines found within numberOfRowsInSection:

// Animate any changes in the number of items
[tableView beginUpdates];
[tableView endUpdates];

I am unclear as to the reason these lines exist as the comment doesn't mean much to me. All i know is that if I delete them this view works like a dream with no visible side effects of my change on 3.2 and greater.

Using images instead of text

I wonder if it is possible to use an image instead of the numbering in the scrollers.

does take some kind of rewrite to do so?

br
kim

is it working in iOS8?

Hi,

I have implemented a viewpager using EasyTableView, however when I try to execute it in iOS8 (iphone5 and iPad) it is not working. I began making tests with iOS7 and it worked like a charm!!

Thanks!

uilabel

Is there any way to get uilabel well rendered with easytableview in horizontal mode?

It seems that CGAffineTransformMakeRotation make the uilabel rendering not very well defined.

Thanks,
Ab

Repeated select of same table view cell

Even if you explicitly deselect a table view cell in the delegate method, repeated select of a cell at the same index path does not work. This is the case even if the cell at that index path is not the same.

iOS7 - first cell seems to disappear

Hi
iOS7 - first cell seems to disappear.
Its moved off the bottom of the table.

revealscreensnapz010

All cells are identical(apart from values in UILabels) when passed into

  • (UIView *)easyTableView:(EasyTableView *)easyTableView viewForRect:(CGRect)rect

I use Reveal App to check values

revealscreensnapz011

EasyTableViewCell is ok

  • rotatedView - these values dont match the other cells
    • my UITableViewCell I pass in -

Screen shot showing values of rotatedView
previewscreensnapz044

on left is value for cells that are ok and visible.
on right is the missing cell

Some problem of easyTable

I have download your lib . After i init the easytable . I don`t know how to reloaddata , I want to choice one , and go down to below menu . The refresh could not work , So i back to the orignal tableview .

deleteRowsAtIndexPaths:withRowAnimation: causes an Assertion Failure

Edit: No bug, My bad :) Excuse me.

When trying to remove one of the items in the tableView by going

[myEasyTableView.tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationTop];

I get the following exception:
Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit_Sim/UIKit-1914.84/UITableView.m:1037

Any ideas?

Cannot compile with Xcode 8

Man, thank you for good lib, but now I cannot compile pod with Xcode 8 (last version). Minimal target is iOS 7.0 and maximum is 10.0.
Please, can you recompile lib for last version of iOS|Xcode, fast as you can?

From Xcode command line:
ld: warning: directory not found for option '-L/Users/im/Library/Developer/Xcode/DerivedData/OptWear-Mobile-asxkvsgbgcvvjkekgtosoiafrawg/Build/Products/Debug-iphonesimulator/EasyTableView'

ld: library not found for -lEasyTableView
clang: error: linker command failed with exit code 1 (use -v to see invocation)

View in landscape mode causes horizontalView not to appear

Hi,

I've been able to get EasyTableVIew to work in my project, however I have an issue when the orientation of the view is set to landscape. My app is configured to work only in landscape modes (by setting the supported orientations to landscape modes in Info.plist) and the view's orientation is set to landscape. In this configuration the horizontalView does not get rendered. However if the view's orientation is set to portrait while keeping only landscape modes in supported orientations in Info.plist the horizontalView is shown. This mentioned behavior seems to only occur for the horizontalView only.

Any info/help you can provide to resolve this is much appreciated.

Thanks.

Auto Layout?

Nice work.

Any thoughts as to making EasyTableView compatible with Auto Layout constraints?

ARC support

What are your thoughts on ARC support? All my current projects are now migrated to ARC

Is this still being maintained - ios7

This is a great contribution, and it looks like it will cover my needs for adding horizontal table views inside table view cells in a vertical table.

Are there any knows issues with my use case or with ios7 / xcode 5?

Is this package still being maintained?

Deletion of rows does not seem to be implemented

I may have my setup wrong, but everything else is working except deletes. I will always get an NSInternalInconsistencyException due to the EasyTableView requesting a row that does not exist after deletion. Hacking it and forcing a call to [easyTableView.tableView reloadData] does not help. Please let me know if I may have missed something. I like the component, but I do need to be able to delete. Thanks.

Landscape mode, horizontal scrolling problem.

Hi, as my application is in landscape mode and needs 2 horizontal scrollviews, I've created them separately using 2 different uiviewcontroller classes and then add them into the mainview class.

This works fine, however, when I tried to scroll the tableview from the right hand corner, it doesn't work. It seems like there is an overlay or something like that that is preventing me to scroll from the right hand side because it works perfectly fine on the left hand side roughly from x-axis 0 to around 768.
(My horizontal tableview width is 1024)

Is this happening because I am creating it in landscape mode?

Thank you.

Unrecognized selector [EasyTableView viewAtIndexPath:indexPath]:

Hi,

thanks for this wonderful project, you have made my life easier.

I have made a little demo using a horizontal EasyTableView which works fine on the simulator but crashes on calling viewAtIndexPath: on the EasyTableView using an ipod touch (latest gen) device. The message I get is:

'NSInvalidArgumentException', reason: '-[EasyTableView viewAtIndexPath:]: unrecognized selector sent to instance...

I have checked and the reference to the EasyTableView is correct.

I used to have the same issue on the simulator but ever since updating to the latest (March 1st, non-ARC) version, it worked fine on the simulator. Any ideas of what could be wrong or what I might be doing wrong?

Thanks in advance,

Michail

More than one horizontal view

quite simply, is it possible to have more than one horizontal tableview?

i need to have two and they should be able to slide independently. it doesn't seem to work when i try to create two horizontals. one is slideable the other is not.

kim

diff for seeing sample on iPhone

lacking a wiki to park it and not wanting to pollute with a branch, here's a quick git diff for EasyTableViewController.m and EasyTableView.xcodeproj/project.pbxproj if you want to try it out on iPhone. works great, thanks alek!

diff --git a/Classes/EasyTableViewController.m b/Classes/EasyTableViewController.m
index 63f117b..6c6ad01 100644
--- a/Classes/EasyTableViewController.m
+++ b/Classes/EasyTableViewController.m
@@ -10,11 +10,11 @@
 #import "EasyTableViewController.h"
 #import "EasyTableView.h"

-#define PORTRAIT_WIDTH                         768
-#define LANDSCAPE_HEIGHT                       (1024-20)
+#define PORTRAIT_WIDTH                         320
+#define LANDSCAPE_HEIGHT                       (480-20)
 #define NUM_OF_CELLS                           21
-#define HORIZONTAL_TABLEVIEW_HEIGHT    140
-#define VERTICAL_TABLEVIEW_WIDTH       180
+#define HORIZONTAL_TABLEVIEW_HEIGHT    60
+#define VERTICAL_TABLEVIEW_WIDTH       60
 #define TABLE_BACKGROUND_COLOR         [UIColor clearColor]

 #define BORDER_VIEW_TAG                                10
@@ -118,7 +118,7 @@
        UILabel *label                  = [[[UILabel alloc] initWithFrame:labelRect] autorelease];
        label.textAlignment             = UITextAlignmentCenter;
        label.textColor                 = [UIColor whiteColor];
-       label.font                              = [UIFont boldSystemFontOfSize:60];
+       label.font                              = [UIFont boldSystemFontOfSize:24];

        // Use a different color for the two different examples
        if (easyTableView == horizontalView)
diff --git a/EasyTableView.xcodeproj/project.pbxproj b/EasyTableView.xcodeproj/project.pbxproj
index b808555..3d5dad2 100755
--- a/EasyTableView.xcodeproj/project.pbxproj
+++ b/EasyTableView.xcodeproj/project.pbxproj
@@ -260,7 +260,7 @@
                                GCC_WARN_UNUSED_VARIABLE = YES;
                                PREBINDING = NO;
                                SDKROOT = iphoneos3.2;
-                               TARGETED_DEVICE_FAMILY = 2;
+                               TARGETED_DEVICE_FAMILY = "1,2";
                        };
                        name = Debug;
                };
@@ -275,7 +275,7 @@
                                OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
                                PREBINDING = NO;
                                SDKROOT = iphoneos3.2;
-                               TARGETED_DEVICE_FAMILY = 2;
+                               TARGETED_DEVICE_FAMILY = "1,2";
                        };
                        name = Release;
                };

Semantic version tags

I’ve recently added EasyTableView to the CocoaPods package manager repo.

CocoaPods is a tool for managing dependencies for OSX and iOS Xcode projects and provides a central repository for iOS/OSX libraries. This makes adding libraries to a project and updating them extremely easy and it will help users to resolve dependencies of the libraries they use.

However, EasyTableView doesn't have any version tags. I’ve added the current HEAD as version 0.0.1, but a version tag will make dependency resolution much easier.

Semantic version tags (instead of plain commit hashes/revisions) allow for resolution of cross-dependencies.

In case you didn’t know this yet; you can tag the current HEAD as, for instance, version 1.0.0, like so:

$ git tag -a 1.0.0 -m "Tag release 1.0.0"
$ git push --tags

Blurry label content

Hello

First of all thank U very much for this peace of code...

After transforming the tableview, newly created coordinates don't have integer vals so the content of the tableview becomes blurry. I suggest some type of rounding new coordinate and size values after performing the transform operation
in

  • (void)createTableWithOrientation:(EasyTableViewOrientation)orientation {

frame change bug

Changing the frame of the easytableview after it is been created, does not update the internal tableview properly

rotation multiple sections

update the section code to this:

I had issues forking and trying to sync. Github kept timing out.

-(UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
if ([delegate respondsToSelector:@selector(easyTableView:viewForHeaderInSection:)]) {

    UIView *view = [[UIView alloc] init];
    UIView *rotatedView = [delegate easyTableView:self viewForHeaderInSection:section];

    if (_orientation == EasyTableViewOrientationHorizontal) {
        rotatedView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
        rotatedView.transform = CGAffineTransformMakeRotation(M_PI/2);
        view.frame = CGRectMake(0, 0, rotatedView.frame.size.height, rotatedView.frame.size.width);
        rotatedView.frame = CGRectMake(0, rotatedView.frame.size.width-rotatedView.frame.size.height, rotatedView.frame.size.width, rotatedView.frame.size.height);
    }
    else {
        rotatedView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
        view.frame = CGRectMake(0, 0, rotatedView.frame.size.width, rotatedView.frame.size.height);
        rotatedView.frame = view.frame;
    }

    rotatedView.clipsToBounds = YES;

    view.clipsToBounds = YES;
    [view addSubview:rotatedView];

    return view;
}
return nil;

}

-(UIView*)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{

if ([delegate respondsToSelector:@selector(easyTableView:viewForFooterInSection:)]) {
    UIView *view = [[UIView alloc] init];
    UIView *rotatedView = [delegate easyTableView:self viewForFooterInSection:section];

    if (_orientation == EasyTableViewOrientationHorizontal) {
        rotatedView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
        rotatedView.transform = CGAffineTransformMakeRotation(M_PI/2);
        view.frame = CGRectMake(0, 0, rotatedView.frame.size.height, rotatedView.frame.size.width);
        rotatedView.frame = CGRectMake(0, rotatedView.frame.size.height-rotatedView.frame.size.width, rotatedView.frame.size.width, rotatedView.frame.size.height);
    }
    else {
        rotatedView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
        view.frame = CGRectMake(0, 0, rotatedView.frame.size.width, rotatedView.frame.size.height);
        rotatedView.frame = view.frame;
    }

    rotatedView.clipsToBounds = YES;

    view.clipsToBounds = YES;
    [view addSubview:rotatedView];

    return view;
}
return nil;

}

Way of deselecting selected cell programmatically

Hi,

is there a proper way of deselecting any previously selected cell of the EasyTableView? Suppose there is a cell selected, and I want to deselect it by triggering an event that does not involve selecting a different cell. How would I do that?

I have accessed the tableView property of the EasyTableView and called deselectRowAtIndexPath on the selected indexPath but to no avail...

Thanks in advance,

Mihalis

Preview next cell

Is it possible to preview a part of the next cell in EasyTableView? I tried setting clipsToBounds but it doesn't work.

Loading Views during animation

I have a horizontal scrolling EasyTableView with a couple of UIImageViews with no user interaction. I scroll the content of my EasyTableView by using:

[UIView animateWithDuration:10 animations:^{ [easyTableView setContentOffset:CGPointMake(500, 0) animated:NO];}];

but when new views get loaded during this animation scroll I see the Images rotating into position slowly.

How to set footerview

How can I set the footer view? I tried using the tableView.footerView property but this is not what I need.

Section Header Views and rotating the device

Section header views seem to get "stuck" on rotation -

  • (UIView *)viewToHoldSectionView:(UIView *)sectionView;

I think it has something to do with this method and the addSubview method...If I disable the "addSubview" method they don't get stuck, perhaps we need an image tag? I don't quite know yet.

Question: Control touch on selected cell

Hi, I want to control touch event on selected cell. I try to custom EasyTableView, but I failed. Please give me any advice.

my try: l208-l211 comment out : failed

//  // Don't allow the currently selected cell to be selectable
//  if ([_selectedIndexPath isEqual:indexPath]) {
//      return nil;
//  }

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.