Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions SwipeView/SwipeView.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,22 @@ typedef NS_ENUM(NSUInteger, SwipeViewAlignment)
- (BOOL)swipeView:(SwipeView *)swipeView shouldSelectItemAtIndex:(NSInteger)index;
- (void)swipeView:(SwipeView *)swipeView didSelectItemAtIndex:(NSInteger)index;

//These method gives you the overrides you need to have the subviews controlled by a UIViewController
//Presumably you will call -[willMoveToParentViewController:nil]
- (void)swipeView:(SwipeView *)swipeView willRemoveSubview:(UIView *)view forItemAtIndex:(NSInteger)index;

//These method gives you the overrides you need to have the subviews controlled by a UIViewController
//Presumably you will call -[removeFromParentViewController]
- (void)swipeView:(SwipeView *)swipeView didRemoveSubview:(UIView *)view forItemAtIndex:(NSInteger)index;

//These method gives you the overrides you need to have the subviews controlled by a UIViewController
//Presumably you will call -[addChildViewController:]
- (void)swipeView:(SwipeView *)swipeView willAddSubview:(UIView *)view forItemAtIndex:(NSInteger)index;

//These method gives you the overrides you need to have the subviews controlled by a UIViewController
//Presumably you will call -[didMoveToParentViewController:]
- (void)swipeView:(SwipeView *)swipeView didAddSubview:(UIView *)view forItemAtIndex:(NSInteger)index;

@end


Expand Down
17 changes: 17 additions & 0 deletions SwipeView/SwipeView.m
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,16 @@ - (UIView *)loadViewAtIndex:(NSInteger)index
[self setItemView:view forIndex:index];
[self setFrameForView:view atIndex:index];
view.userInteractionEnabled = YES;

if (_delegate && [_delegate respondsToSelector:@selector(swipeView:willAddSubview:forItemAtIndex:)])
{
[self.delegate swipeView:self willAddSubview:oldView forItemAtIndex:index];
}
[_scrollView addSubview:view];
if (_delegate && [_delegate respondsToSelector:@selector(swipeView:didAddSubview:forItemAtIndex:)])
{
[self.delegate swipeView:self didAddSubview:oldView forItemAtIndex:index];
}

return view;
}
Expand Down Expand Up @@ -959,7 +968,15 @@ - (void)loadUnloadViews
{
UIView *view = _itemViews[number];
[self queueItemView:view];
if (_delegate && [_delegate respondsToSelector:@selector(swipeView:willRemoveSubview:forItemAtIndex:)])
{
[self.delegate swipeView:self willRemoveSubview:view forItemAtIndex:number.integerValue];
}
[view removeFromSuperview];
if (_delegate && [_delegate respondsToSelector:@selector(swipeView:didRemoveSubview:forItemAtIndex:)])
{
[self.delegate swipeView:self didRemoveSubview:view forItemAtIndex:number.integerValue];
}
[_itemViews removeObjectForKey:number];
}
}
Expand Down