Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix an issue where leaving the app & coming back in would ignore keyboard #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
6 changes: 3 additions & 3 deletions FPPopoverController.m
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ -(id)initWithViewController:(UIViewController*)viewController
_touchView.backgroundColor = [UIColor clearColor];
_touchView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
_touchView.clipsToBounds = NO;
[_touchView becomeFirstResponder];
[self.view addSubview:_touchView];

__block typeof (self) bself = self;
[_touchView setTouchedOutsideBlock:^{
[bself dismissPopoverAnimated:YES];
Expand All @@ -99,9 +100,8 @@ -(id)initWithViewController:(UIViewController*)viewController

_contentView = [[FPPopoverView alloc] initWithFrame:CGRectMake(0, 0,
self.contentSize.width, self.contentSize.height)];

_viewController = viewController;

[_touchView addSubview:_contentView];

[_contentView addContentView:_viewController.view];
Expand Down
8 changes: 6 additions & 2 deletions FPTouchView.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

@implementation FPTouchView


-(void)setTouchedOutsideBlock:(FPTouchedOutsideBlock)outsideBlock
{
_outsideBlock = outsideBlock;
Expand All @@ -21,6 +20,11 @@ -(void)setTouchedInsideBlock:(FPTouchedInsideBlock)insideBlock
_insideBlock = insideBlock;
}

- (BOOL)canBecomeFirstResponder
{
return YES;
}

-(UIView*)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
UIView *subview = [super hitTest:point withEvent:event];
Expand All @@ -45,7 +49,7 @@ -(UIView*)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
_insideBlock();
}
else if(!touchedInside && _outsideBlock)
else if(self.isFirstResponder && !touchedInside && _outsideBlock)
{
_outsideBlock();
}
Expand Down