-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9b51495
commit c2e81d7
Showing
12 changed files
with
654 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
PODS: | ||
- SZEasyTipView (0.1.0) | ||
|
||
DEPENDENCIES: | ||
- SZEasyTipView (from `../`) | ||
|
||
EXTERNAL SOURCES: | ||
SZEasyTipView: | ||
:path: ../ | ||
|
||
SPEC CHECKSUMS: | ||
SZEasyTipView: e1db3262a81be0a789528a8ad579d2260102c7da | ||
|
||
PODFILE CHECKSUM: 6dba0dc55a6b982041f0419bb363df9945921a78 | ||
|
||
COCOAPODS: 1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
Example/SZEasyTipView.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// SZNavigationController.h | ||
// SZEasyTipView | ||
// | ||
// Created by Song Zhou on 5/29/16. | ||
// Copyright © 2016 Song Zhou. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface SZNavigationController : UINavigationController | ||
|
||
@end | ||
|
||
@interface SZTableViewController : UITableViewController | ||
|
||
@property (nonatomic) NSArray *data; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// | ||
// SZNavigationController.m | ||
// SZEasyTipView | ||
// | ||
// Created by Song Zhou on 5/29/16. | ||
// Copyright © 2016 Song Zhou. All rights reserved. | ||
// | ||
|
||
#import "SZNavigationController.h" | ||
#import "SZEasyTipView.h" | ||
|
||
@interface SZNavigationController () | ||
|
||
@end | ||
|
||
@implementation SZNavigationController | ||
|
||
- (void)viewDidLoad { | ||
[super viewDidLoad]; | ||
|
||
self.title = @"test"; | ||
|
||
} | ||
|
||
- (void)didReceiveMemoryWarning { | ||
[super didReceiveMemoryWarning]; | ||
// Dispose of any resources that can be recreated. | ||
} | ||
@end | ||
|
||
static NSString * const testCellIdentifier = @"test cell"; | ||
|
||
@implementation SZTableViewController | ||
|
||
- (void)viewDidLoad { | ||
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemEdit target:self action:@selector(tapOnLeft:)]; | ||
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSearch target:self action:@selector(tapOnRight:)]; | ||
|
||
|
||
[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:testCellIdentifier]; | ||
_data = @[@1, @2, @3, @4, @5]; | ||
} | ||
|
||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { | ||
return 1; | ||
} | ||
|
||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { | ||
return _data.count; | ||
} | ||
|
||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | ||
NSString *text = [_data[indexPath.row] stringValue]; | ||
UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:testCellIdentifier]; | ||
|
||
cell.textLabel.text = text; | ||
|
||
UIButton *disclosure = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; | ||
[disclosure addTarget:self action:@selector(tapOnDisclosure:) forControlEvents:UIControlEventTouchUpInside]; | ||
|
||
cell.accessoryView = disclosure; | ||
|
||
return cell; | ||
} | ||
|
||
- (void)tapOnDisclosure:(UIButton *)sender { | ||
[SZEasyTipView showForView:sender withinSuperView:self.tableView text:@"Lose yourself - Eminem" config:nil delegate:nil animated:YES]; | ||
} | ||
|
||
|
||
|
||
- (void)tapOnLeft:(UIBarButtonItem *)sender { | ||
[SZEasyTipView showForItem:sender withinSuperView:nil text:@"you tap on left" config:nil delegate:nil animated:YES]; | ||
} | ||
|
||
- (void)tapOnRight:(UIBarButtonItem *)sender { | ||
[SZEasyTipView showForItem:sender withinSuperView:nil text:@"you tap on right" config:nil delegate:nil animated:YES]; | ||
} | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,4 +26,4 @@ Song Zhou, [email protected] | |
|
||
## License | ||
|
||
SZEasyTipView is available under the MIT license. See the LICENSE file for more info. | ||
SZEasyTipView is available under the BSD license. See the LICENSE file for more info. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
Pod::Spec.new do |s| | ||
s.name = 'SZEasyTipView' | ||
s.version = '0.1.0' | ||
s.summary = 'A short description of SZEasyTipView.' | ||
s.summary = 'Elegant tooltip view written in Objective-C, copy from EasyTipView(https://github.com/teodorpatras/EasyTipView)' | ||
|
||
# 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,15 +18,15 @@ Pod::Spec.new do |s| | |
# * Finally, don't worry about the indent, CocoaPods strips it! | ||
|
||
s.description = <<-DESC | ||
TODO: Add long description of the pod here. | ||
EasyTipView is a fully customisable tooltip view written in Objective-C that can be used as a call to action or informative tip. It can be shown above of below any UIBarItem or UIView subclass. | ||
DESC | ||
|
||
s.homepage = 'https://github.com/<GITHUB_USERNAME>/SZEasyTipView' | ||
s.homepage = 'https://github.com/gogozs/SZEasyTipView' | ||
# s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2' | ||
s.license = { :type => 'MIT', :file => 'LICENSE' } | ||
s.license = { :type => 'BSD', :file => 'LICENSE' } | ||
s.author = { 'Song Zhou' => '[email protected]' } | ||
s.source = { :git => 'https://github.com/<GITHUB_USERNAME>/SZEasyTipView.git', :tag => s.version.to_s } | ||
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>' | ||
s.source = { :git => 'https://github.com/gogozs/SZEasyTipView.git', :tag => s.version.to_s } | ||
s.social_media_url = 'https://twitter.com/songzhou21' | ||
|
||
s.ios.deployment_target = '8.0' | ||
|
||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
// | ||
// SZEasyTipView.h | ||
// SZEasyTipView | ||
// | ||
// Created by Song Zhou on 5/28/16. | ||
// Copyright © 2016 Song Zhou. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
#define SZLeftTopPoint(frame) CGPointMake(frame.origin.x, frame.origin.y) | ||
#define SZLeftBottomPoint(frame) CGPointMake(frame.origin.x, frame.origin.y + frame.size.height) | ||
#define SZRightTopPoint(frame) CGPointMake(frame.origin.x + frame.size.width, frame.origin.y) | ||
#define SZRightBottomPoint(frame) CGPointMake(frame.origin.x + frame.size.width, frame.origin.y + frame.size.height) | ||
|
||
#define SZPathAddArcToPoint(path, point1, point2, radius) \ | ||
CGPathAddArcToPoint(path, NULL, point1.x, point1.y, point2.x, point2.y, radius) | ||
|
||
#define SZPathAddRoundRectWithPoints(path, point1, point2, point3, point4, radius) \ | ||
SZPathAddArcToPoint(path, point1, point2, radius);\ | ||
SZPathAddArcToPoint(path, point2, point3, radius);\ | ||
SZPathAddArcToPoint(path, point3, point4, radius);\ | ||
SZPathAddArcToPoint(path, point4, point1, radius) | ||
|
||
|
||
typedef NS_ENUM(NSInteger, SZArrowPosition) { | ||
SZArrowPositionTop, | ||
SZArrowPositionBottom | ||
}; | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@class SZConfig, SZEasyTipView; | ||
|
||
@protocol SZEasyTipViewDelegate <NSObject> | ||
|
||
@optional | ||
- (void)easyTipViewDidDismiss:(SZEasyTipView *)view; | ||
@end | ||
|
||
|
||
@interface SZEasyTipView : UIView | ||
|
||
- (instancetype)initWithText:(NSString *)text config:(SZConfig * __nullable)config delegate:(id<SZEasyTipViewDelegate> __nullable)delegate; | ||
|
||
+ (void)showForView:(UIView *)view withinSuperView:(UIView * __nullable)superView text:(NSString *)text config:(SZConfig * __nullable)config delegate:(id<SZEasyTipViewDelegate> __nullable)delegate animated:(BOOL)animated; | ||
+ (void)showForItem:(UIBarItem *)item withinSuperView:(UIView * __nullable)superView text:(NSString *)text config:(SZConfig * __nullable)config delegate:(id<SZEasyTipViewDelegate> __nullable)delegate animated:(BOOL)animated; | ||
|
||
- (void)showForView:(UIView *)view withinSuperView:(UIView * __nullable)superView animated:(BOOL)animated; | ||
- (void)showForItem:(UIBarItem *)item withinSuperView:(UIView * __nullable)superView animated:(BOOL)animated; | ||
@end | ||
|
||
@interface SZConfig : NSObject | ||
|
||
#pragma mark - Drawing | ||
@property (nonatomic) CGFloat cornerRadius; | ||
@property (nonatomic) CGFloat arrowHeight; | ||
@property (nonatomic) CGFloat arrowWidth; | ||
@property (nonatomic) UIColor *foregroundColor; | ||
@property (nonatomic) UIColor *backgroundColor; | ||
@property (nonatomic) SZArrowPosition arrowPosition; | ||
@property (nonatomic) NSTextAlignment textAlignment; | ||
@property (nonatomic) CGFloat borderWidth; | ||
@property (nonatomic) UIColor *borderColor; | ||
@property (nonatomic) UIFont *font; | ||
|
||
#pragma mark - Positioning | ||
@property (nonatomic) CGFloat bubbleHInset; | ||
@property (nonatomic) CGFloat bubbleVInset; | ||
@property (nonatomic) CGFloat textHInset; | ||
@property (nonatomic) CGFloat textVInset; | ||
@property (nonatomic) CGFloat maxWidth; | ||
|
||
#pragma mark - Animating | ||
@property (nonatomic) CGAffineTransform dismissTransform; | ||
@property (nonatomic) CGAffineTransform showInitialTransform; | ||
@property (nonatomic) CGAffineTransform showFinalTransform; | ||
@property (nonatomic) CGFloat springDamping; | ||
@property (nonatomic) CGFloat springVelocity; | ||
@property (nonatomic) CGFloat showInitialAlpha; | ||
@property (nonatomic) CGFloat dismissFinalAlpha; | ||
@property (nonatomic) CGFloat showDuration; | ||
@property (nonatomic) CGFloat dismissDuration; | ||
|
||
@property (nonatomic, getter=hasBorder) BOOL border; | ||
|
||
@end | ||
|
||
@interface UIView (SZExtension) | ||
|
||
- (CGPoint)originDistantWithinSuperView:(UIView *)superView; | ||
- (BOOL)hasSuperView:(UIView *)superView; | ||
|
||
@end | ||
|
||
@interface UIBarItem (SZExtension) | ||
|
||
- (UIView *)SZView; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
Oops, something went wrong.