Skip to content

Commit

Permalink
Exposed fromFrame
Browse files Browse the repository at this point in the history
  • Loading branch information
andreamazz committed Dec 31, 2014
1 parent 83c88ae commit 721b7f5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
6 changes: 6 additions & 0 deletions AMPopTip/AMPopTip.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,12 @@ typedef NS_ENUM(NSInteger, AMPopTipDirection) {
*/
@property (nonatomic, assign) NSTimeInterval delayOut UI_APPEARANCE_SELECTOR;

/** The frame the poptip is pointing to
*
* Holds the CGrect with the rect the tip is pointing to
*/
@property (nonatomic, assign) CGRect fromFrame;

/** Visibility
*
* Holds the readonly BOOL with the popover visiblity. The popover is considered visible as soon as
Expand Down
11 changes: 8 additions & 3 deletions AMPopTip/AMPopTip.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ @interface AMPopTip()
@property (nonatomic, assign) CGRect textBounds;
@property (nonatomic, assign) CGPoint arrowPosition;
@property (nonatomic, assign) CGFloat maxWidth;
@property (nonatomic, assign) CGRect fromFrame;

@end

Expand Down Expand Up @@ -375,7 +374,7 @@ - (void)showText:(NSString *)text direction:(AMPopTipDirection)direction maxWidt
self.direction = direction;
self.containerView = view;
self.maxWidth = maxWidth;
self.fromFrame = frame;
_fromFrame = frame;

[self show];
}
Expand All @@ -388,11 +387,17 @@ - (void)showAttributedText:(NSAttributedString *)text direction:(AMPopTipDirecti
self.direction = direction;
self.containerView = view;
self.maxWidth = maxWidth;
self.fromFrame = frame;
_fromFrame = frame;

[self show];
}

- (void)setFromFrame:(CGRect)fromFrame
{
_fromFrame = fromFrame;
[self setup];
}

- (void)showText:(NSString *)text direction:(AMPopTipDirection)direction maxWidth:(CGFloat)maxWidth inView:(UIView *)view fromFrame:(CGRect)frame duration:(NSTimeInterval)interval
{
[self showText:text direction:direction maxWidth:maxWidth inView:view fromFrame:frame];
Expand Down
2 changes: 2 additions & 0 deletions PopTipDemo/PopTipDemo/PopTipDemo-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
Expand Down

0 comments on commit 721b7f5

Please sign in to comment.