From b459995f9b38783cf10f9f02ba1085f3971a1008 Mon Sep 17 00:00:00 2001 From: Manuel Escrig Ventura Date: Thu, 3 Mar 2016 11:23:35 +0100 Subject: [PATCH] Fixed bug that the Button was disappearing after presenting and dismissing a view controller on top --- Example/MEVFloatingButton/MEVExample1ViewController.m | 4 +++- MEVFloatingButton.podspec | 9 +++------ Pod/Classes/UIScrollView+FloatingButton.m | 9 ++++++--- README.md | 2 +- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Example/MEVFloatingButton/MEVExample1ViewController.m b/Example/MEVFloatingButton/MEVExample1ViewController.m index 3f7a7ab..3ee39b2 100644 --- a/Example/MEVFloatingButton/MEVExample1ViewController.m +++ b/Example/MEVFloatingButton/MEVExample1ViewController.m @@ -8,6 +8,7 @@ #import "MEVExample1ViewController.h" #import "UIScrollView+FloatingButton.h" +#import "MEVExample4ViewController.h" static NSString *CellIdentifier = @"CellIdentifier"; @@ -76,7 +77,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N - (void)floatingButton:(UIScrollView *)scrollView didTapButton:(UIButton *)button { NSLog(@"didTapButton"); - [self.tableView setContentOffset:CGPointMake(0, -self.tableView.contentInset.top) animated:YES]; + MEVExample4ViewController *viewController = [MEVExample4ViewController new]; + [self presentViewController:[[UINavigationController alloc] initWithRootViewController:viewController] animated:YES completion:nil]; } - (void)floatingButtonWillAppear:(UIScrollView *)scrollView { diff --git a/MEVFloatingButton.podspec b/MEVFloatingButton.podspec index 1be8688..ea46685 100644 --- a/MEVFloatingButton.podspec +++ b/MEVFloatingButton.podspec @@ -8,8 +8,8 @@ Pod::Spec.new do |s| s.name = "MEVFloatingButton" - s.version = "0.5.0" - s.summary = "An iOS drop-in UITableView/UICollectionView/UIScrollView superclass category for showing a customizable floating button on top of it." + s.version = "1.1.2" + s.summary = "An iOS drop-in UITableView, UICollectionView, UIScrollView superclass category for showing a customizable floating button on top of it." # This description is used to generate tags and improve search results. # * Think: What does it do? Why did you write it? What is the focus? @@ -18,14 +18,11 @@ Pod::Spec.new do |s| # * Finally, don't worry about the indent, CocoaPods strips it! s.description = <<-DESC - An iOS drop-in UITableView/UICollectionView/UIScrollView superclass category for showing a customizable floating button on top of it. A very customazible category in order to add a floating button as seen as in material design on top of a UIScrollView, UITableView or a UICollectionView. - Includes different delegate methods such us 'didTapButton', 'floatingButtonWillAppear', 'floatingButtonDidAppear', 'floatingButtonWillDisappear' and 'floatingButtonDidDisappear'. - DESC s.homepage = "https://github.com/manuelescrig/MEVFloatingButton" - # s.screenshots = "https://cloud.githubusercontent.com/assets/1849990/13219261/29aef4a8-d96f-11e5-8632-85b31c3c1c1f.gif", "https://cloud.githubusercontent.com/assets/1849990/13219263/29d8c3b4-d96f-11e5-9d12-502363e77759.gif", "https://cloud.githubusercontent.com/assets/1849990/13219262/29d78f94-d96f-11e5-8d01-0805ef799160.gif", "https://cloud.githubusercontent.com/assets/1849990/13219329/9efde354-d96f-11e5-88a5-4175729e471e.gif" + # s.screenshots = "https://cloud.githubusercontent.com/assets/1849990/13462466/db001be6-e087-11e5-92a1-79c8ecefb715.gif" s.license = 'MIT' s.author = { "Manuel Escrig Ventura" => "manuelescrig@gmail.com" } s.source = { :git => "https://github.com/manuelescrig/MEVFloatingButton.git", :tag => s.version.to_s } diff --git a/Pod/Classes/UIScrollView+FloatingButton.m b/Pod/Classes/UIScrollView+FloatingButton.m index b2d6add..bbb34e1 100644 --- a/Pod/Classes/UIScrollView+FloatingButton.m +++ b/Pod/Classes/UIScrollView+FloatingButton.m @@ -291,7 +291,7 @@ void Swizzle(Class c, SEL orig, SEL new) } - (void)mev_dealloc -{ +{ @try { [self removeObserver:self forKeyPath:kObserverContentOffset context:nil]; [self removeObserver:self forKeyPath:kObserverContentSize context:nil]; @@ -308,8 +308,11 @@ - (void)mev_dealloc - (void)mev_willMoveToWindow:(UIWindow *)newWindow { if (!newWindow) { - [self mev_stopTimer]; - [self mev_didDisappear]; + if (self.floatingButton.displayMode != MEVFloatingButtonDisplayModeAlways && + self.floatingButton.displayMode != MEVFloatingButtonDisplayModeNone) { + [self mev_stopTimer]; + [self mev_didDisappear]; + } } [self mev_willMoveToWindow:newWindow]; diff --git a/README.md b/README.md index 1771083..2de4764 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # MEVFloatingButton -An iOS **drop-in** UITableView/UICollectionView/UIScrollView superclass **category** for showing a customizable floating button on top of it. MEVFloatingButton is also compatible with ASCollectionView/ASTableView from [AsynDisplayKit](https://github.com/facebook/AsyncDisplayKit). +An iOS **drop-in** UITableView, UICollectionView, UIScrollView superclass **category** for showing a customizable floating button on top of it. MEVFloatingButton is also compatible with ASCollectionView/ASTableView from [AsynDisplayKit](https://github.com/facebook/AsyncDisplayKit). [![Version](https://img.shields.io/cocoapods/v/MEVFloatingButton.svg?style=flat)](http://cocoapods.org/pods/MEVFloatingButton) [![License](https://img.shields.io/cocoapods/l/MEVFloatingButton.svg?style=flat)](http://cocoapods.org/pods/MEVFloatingButton)