GithubHelp home page GithubHelp logo

john-lluch / swrevealtableviewcell Goto Github PK

View Code? Open in Web Editor NEW
426.0 426.0 63.0 5.58 MB

Highly configurable UITableViewCell subclass to display left and right buttons, similar to iOS8 mail app, based on user pan gestures or developer programmatic actions.

License: MIT License

Objective-C 99.14% Ruby 0.86%

swrevealtableviewcell's People

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

swrevealtableviewcell's Issues

single cell opened

Hello @John-Lluch and thanks for open sourcing this lib of yours.
I have a question regarding the numbers of cells that are left opened after swipe.
Is it possible to make it work by having only 1 item opened at each time.

Take a look at your Phone app. if you swipe to delete a call and then try to swipe at another cell or even touch your previous cell gets swiped back to its default location.

thanks

Dismiss opened cell upon responder change

I swipe to open one cell.
I can then drag another cell, while the first cell is still opened.
Tapping outside of the cell, or even on the opened cell (not the buttons) doesn't dismiss the opened cell.

I'm thinking it should respond like the default mail app swipes where it doesn't allow me to work on another cell until the original one is complete dismissed.

Graphic artifact when swiping fast

capture decran du simulateur ios 23 juil 2014 11 59 55
When the user swipes fast to reveal the underlying buttons (and theses buttons have a backgroundColor), there is a small white gap between buttons when they are stretched the first time.
After, the artifact is no longer present

didmovetowindow wrong behavior

Hello, i have found an issue:
Didmovetowindow in created cell calling every time we move from current screen or we move back to this screen. So for ex. we push some controller (it can be tableviewcontroller from your example) in our navigation stack :
SWCellButtonItem *item2 = [SWCellButtonItem itemWithTitle:@"Open box" handler:^(SWCellButtonItem *item, SWRevealTableViewCell *cell)
{
_revealingCellIndexPath = [self.tableView indexPathForCell:cell];
TableViewController *tableViewController = [[TableViewController alloc] initWithStyle:UITableViewStylePlain];
[self.navigationController pushViewController:tableViewController animated:YES];
.....

so every time when current tableviewcontroller dissmised and appeared didmovetowindow called in every created cell and new utilityview created and added again to our cell in didmovetowindow:
_utilityContentView = [[SWUtilityContentView alloc] initWithRevealTableViewCell:self frame:self.bounds];
[_utilityContentView setAutoresizesSubviews:NO];
[_utilityContentView setAutoresizingMask:UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight];
[_revealLayoutView insertSubview:_utilityContentView atIndex:0];

So number of our contentviews increases infinitely:
po [_revealLayoutView subviews]
__NSArrayM 0x8d77150>(
SWUtilityContentView: 0x8c70470; frame = (0 0; 320 44); autoresize = W+H;...,
SWUtilityContentView: 0x9c8a170; frame = (0 0; 320 43.5); autoresize = W+H;...,
SWUtilityContentView: 0x9c66d30; frame = (0 0; 320 43.5); autoresize = W+H;...,
SWUtilityContentView: 0x8fb6040; frame = (0 0; 320 43.5); autoresize = W+H; ...,
<SWUtilityContentView: 0x9863a30; frame = (0 0; 320 43.5); autoresize = W+H; ..,
UITableViewCellContentView: 0x9861d30; frame = (0 0; 320 43.5); gestureRecognizers = ...,
_UITableViewCellSeparatorView: 0x9863c90; frame = (47 43.5; 273 0.5); layer = ...
)

Also because of didmovetowindow
// Finally, set the actual position
[self _setRevealPosition:initialPosition withDuration:0.0];
delegate methods like revealTableViewCell:(SWRevealTableViewCell *)revealTableViewCell didMoveToPosition: are called every time - issue in here is that if u implement logic when u can show again last opened cell after scrolling and reusing some created cell for this one (not implemented in current example - u can do this through adding ivar for ex. lastIndexPath and set value on didmovetoposition) and u want to hide that cell when user goes from current screen but cell not visible (but it exists) you only can set lastIndexPath to nil in viewdiddissapear, but after that delegate sets lastIndexPath to prev value of opened cell on didmovetowindow.
Basically i want to say that on next didmovetowindow initialPosition equal SWCellRevealPositionLeft and all delegate methods called for unknown purpose.. so maybe we must use logic in didmovetowindow only one time per cell ?

To know when the left or right items are showing

It's possible to know when the items is showing, maybe with a BOOL ?
That is a sort of status of the items visualization.
These methods....
- (void)revealTableViewCell:(SWRevealTableViewCell *)revealTableViewCell willMoveToPosition:(SWCellRevealPosition)position;
- (void)revealTableViewCell:(SWRevealTableViewCell *)revealTableViewCell didMoveToPosition:(SWCellRevealPosition)position;
...are not enough, because tell when the movement of the cell began and finish... not all the time that the items are sown in the cell.

Thank you

Element position in SWCellButtonItem

Hello! I can't find property to set position title and image. Because title is NSString, not UILabel. And image is UIImage, not UIImageView. And I can't change the font for title.
What a can use for fix this collision?

ios 8: custom subviews of cell get offset twice.

If you try to add a custom element (any view) to your cell's view in IOS8 you'll see that they get away from screen very fast while swiping and they never get back. This is caused by redundant offset modification to the subviews of UITableViewCellContentView after UITableViewCellContentView's offset is modified.
In the SWRevealTableViewCell.m : - (void)_setRevealLocation:(CGFloat)xLocation


    for ( UIView *view in _revealLayoutView.subviews )
    {
        // One of the contentView's siblings of is the cell's separatorView.
        // We do not want to apply our custom layout to that particular view, so we skip that view based on its class name.
        // This is of course hacky and may break in the future. However since we choose to apply our layout directly to the cell, as oposed to
        // the cell's contentView we do not have other choice than filtering this here.
        // If this code breaks on a future iOS release it will be very easy to fix anyway.
        {
            if ( [NSStringFromClass([view class]) rangeOfString:@"Separator"].length > 0 )
                continue;
        }

        view.frame = CGRectOffset(view.frame, xLocation, 0 );
    }
}

I suppose the only views which frames need to be modified here are SWUtilityContentView and UITableViewCellContentView.
However, if you add your subviews to cell.contentView everything works fine.

buttons stack on top

I have a cell height at 200. Is it possible to add the buttons on top of each other instead of next to each other or would that be a bigger implementation?

use custom UITableViewCell with SWRevealTableViewCell

Hi !
I'm trying to use your wonderful SWRevealTableViewCell with my custom UITableViewCell but I can't... I have juste blank cell.
Can you help me ? I have my custom cell in a .xib and my class (FeedTableCell) contains only a image view, a label and a text view.

Thanks for your help !

Gautier

Right-most button obscured by table section index titles

If your table view uses section indexes which are placed on the right-hand side of the table view (so you can quickly navigate to different sections in your alphabetized table), the right-most SWRevealTableViewCell button gets obscured. The buttons should be offset to the left by about 15 pixels in this situation.

It could be as easy as passing a tableSectionIndexOffset value during cellForRowAtIndexPath: or maybe even a BOOL.
screenshot 2014-09-15 17 07 17

Crash - Happens if the reveal menu is opened and a full screen transition happens

Hey!

First of all thanks for the good work, I really appreciate the SWRevealTableViewCell!

I've got the reveal menu opened in one of my TableViewCells, if I do a full screen transition to another screen (that also has a TableView with reveal function), it crashes.

If I change the reveal position of all SWRevealTableViewCells to center in viewWillDisappear, the crash won't happen. This comes in combination with weird flashes on my TableViewCells.

I hope you have an idea how to fix this!

Cheers,
Max

Is it possible to style the buttons?

I'd like to change the font/font-size on the buttons. I'd also like to set a background state (on/off) where the color changes. Are either of these possible?

Default methods of `dataSource`

Hello,
I think that it will be good to support default methods of dataSource. For example, leftButtonItemsInRevealTableViewCell: will return @[] if dataSource does not respond to leftButtonItemsInRevealTableViewCell:

iOS 8 animation is not consistent.

I expect some issues around this with what they have added to iOS.

What I notice is sometimes when you swipe, the content view completely bounces over to the other side before coming back causing a jumping effect.

Other than that detail, it works great on both iOS 7 and 8.

How to properly reset all button items?

I'm trying to change items when a user logs in or logs out and I'm noticing it keep the old items there but also add the new ones.

What public API can I use to do this? I see some private methods for this.

Question - Best way to slide the menu back when beginning the touch on the buttons

Hey,

It's me again, this time with a question: What do you think is the best (and easiest) way to be able to slide the reveal menu back on the revealed buttons?

The first idea that came to my mind was to add a GestureRecognizer with the exact same functionality as on the TableViewCell to the revealed buttons.

Is there an easier way than this?

I hope you have some time answer ;)
Best,
Max

Images

These images are linked to in the ReadMe file
2014-08-20 15_02_31
2014-08-21 14_50_30
2014-08-21 14_53_52

Sometimes when swipe-opening the reveal cell, there's a brief white flash

Sometimes when you swipe-open the reveal cell (and it might happen more ofthen when doing it with a fast flick), there's a white flash and the cell's content completely disappears for a split second.

Then it reappears again and everything is working fine.

I've seen this on both iOS 7 and 8, Device and Simulator.

UITableViewCellStyleSubtitle

Hi!
I have a UITableViewCell using UITableViewCellStyleSubtitle from IB.
After using SWRevealTableViewCell the subtitle isn;t visible anymore.
Any suggestions?

cell ignores performsActionOnRightOverdraw setting?

I have a custom UITableViewCell inheriting from SWRevealTableViewCell that even though I set cell.performsActionOnRightOverdraw = NO; cell.performsActionOnLeftOverdraw = NO; it still seems to perform the action when the cell is pulled 'too far' to the left (revealing right items).

My cellForRowAtIndexPath is essentially

HHAPropertyViewingListTableViewCell *cell = (HHAPropertyViewingListTableViewCell *)[tableView dequeueReusableCellWithIdentifier:ReuseIdentifier forIndexPath:indexPath];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    /*
        code omitted because really its just setting labels and things, really nothing of interest happens here but if you _really_ care i can post it
    */
    cell.dataSource = self;
    cell.performsActionOnRightOverdraw = NO;
    cell.performsActionOnLeftOverdraw = NO;

    return cell;

For my right items I've got this lovely (thank for for the iOS 8 like API, even if it wasn't intentional)

#pragma mark - SWRevealTableViewCellDataSource
- (NSArray *)rightButtonItemsInRevealTableViewCell:(SWRevealTableViewCell *)revealTableViewCell {
    SWCellButtonItem *delete = [SWCellButtonItem itemWithTitle:NSLocalizedString(@"Delete", @"Delete") handler:^BOOL(SWCellButtonItem *item, SWRevealTableViewCell *cell) {
        NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
        DDLogDebug(@"Delete indexPath - %@", indexPath);
        [self tableView:self.tableView deleteRowAtIndexPath:indexPath];
        return YES;
    }];

    SWCellButtonItem *openInMaps = [SWCellButtonItem itemWithTitle:NSLocalizedString(@"Maps", @"Maps") handler:^BOOL(SWCellButtonItem *item, SWRevealTableViewCell *cell) {
        NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
        DDLogDebug(@"Maps indexPath - %@", indexPath);
        HHAUserListProperty *property = self->_properties[indexPath.row];
        [[HHAMapAndDistanceHelpers mapItemForUserListProperty:property] openInMapsWithLaunchOptions:@{}];
        return YES;
    }];

    SWCellButtonItem *move = [SWCellButtonItem itemWithTitle:NSLocalizedString(@"Move", @"Move") handler:^BOOL(SWCellButtonItem *item, SWRevealTableViewCell *cell) {
        NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
        DDLogDebug(@"Move indexPath - %@", indexPath);
        [self movePropertyAtIndexPath:indexPath];
        return NO;
    }];

    CGFloat width = 75;

    delete.backgroundColor = [UIColor redColor];
    delete.tintColor = [UIColor whiteColor];
    delete.width = width;

    openInMaps.backgroundColor = [UIColor houseHappy];
    openInMaps.tintColor = [UIColor whiteColor];
    openInMaps.width = width;

    move.backgroundColor = [UIColor colorWithWhite:0.7 alpha:1.0];
    move.tintColor = [UIColor whiteColor];
    move.width = width;

    return @[delete, openInMaps, move];
}

So when i 'pull too far' on the cell to the left revealing the right items, it performs the delete action. However, i'd like to turn that off (on an iPad its way too easy to trigger that pull) but the cell doesn't seem to listen.

Am i configuring that setting in the incorrect location by chance? Or perhaps missing something?

Thanks

Update SWCellButtonItem's image on tap

Hi
First of all thanks for this library, it works just great.
I was wondering if there's a way to change the SWCellButtonItem's image within the handler of the item. Something along this lines:

    SWCellButtonItem *item = [SWCellButtonItem itemWithImage:[UIImage imageNamed:@"on"] handler:^(SWCellButtonItem *item, SWRevealTableViewCell *cell) {
        item.image = [UIImage imageNamed:@"off"];
    }];

I need to do this since my image is a toggle associated with the cell.
Is there any way to do so?
Thanks

Xcode 6.3 fabsf truncation warnings

With Xcode 6.3 SWRevealTableViewCell.m began to receive these warnings:

SWRevealTableViewCell/SWRevealTableViewCell.m:1471:9: Absolute value function 'fabsf' given an argument of type 'CGFloat' (aka 'double') but has parameter of type 'float' which may cause truncation of value

Should these fabsf be switched to fabs?

Can't delete cells in the default edit mode

Using the Example app, add the following line at the end of viewDidLoad in TableViewController:
self.tableView.editing = YES;
This will start the app in an editable mode, showing the default delete button on the left edge of the cells. Now, when clicking any of the delete buttons it shows the delete confirmation button briefly on the right but then hides it.

Fire rightbuttons on tap cell

Hi,
I need to fire the right buttons when the user tap a Cell. How can I do it?

  • (void)tableView:(UITableView )tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    //[tableView deselectRowAtIndexPath:indexPath animated:YES];
    SWRevealTableViewCell *cell = (SWRevealTableViewCell
    )[tableView cellForRowAtIndexPath:indexPath];
    [self rightButtonItemsInRevealTableViewCell:cell];
    }
    Thanks!

CALayerPosition contains Nan

Getting the following error on iOS 7.1:

Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan 29.75]

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.