Skip to content

Commit

Permalink
bump to 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
songzhou21 committed Jun 18, 2016
1 parent 9b51495 commit c2e81d7
Show file tree
Hide file tree
Showing 12 changed files with 654 additions and 9 deletions.
16 changes: 16 additions & 0 deletions Example/Podfile.lock
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
6 changes: 6 additions & 0 deletions Example/SZEasyTipView.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
6003F5BC195388D20070C39A /* Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5BB195388D20070C39A /* Tests.m */; };
61581E661868CC96968B0ADD /* Pods_SZEasyTipView_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ECF64A3152E18C312A4795DB /* Pods_SZEasyTipView_Tests.framework */; };
873B8AEB1B1F5CCA007FD442 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */; };
E44BB2A11D1579B2003C9E83 /* SZNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = E44BB2A01D1579B2003C9E83 /* SZNavigationController.m */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -64,6 +65,8 @@
B143B0AF69B6E7B01F4D24EB /* SZEasyTipView.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = SZEasyTipView.podspec; path = ../SZEasyTipView.podspec; sourceTree = "<group>"; };
D3EEFED231A0CA396A27240B /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; };
E389105DC30762D732FECBF7 /* Pods-SZEasyTipView_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SZEasyTipView_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-SZEasyTipView_Example/Pods-SZEasyTipView_Example.release.xcconfig"; sourceTree = "<group>"; };
E44BB2A01D1579B2003C9E83 /* SZNavigationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SZNavigationController.m; sourceTree = "<group>"; };
E44BB2A21D1579B7003C9E83 /* SZNavigationController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SZNavigationController.h; sourceTree = "<group>"; };
ECF64A3152E18C312A4795DB /* Pods_SZEasyTipView_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SZEasyTipView_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -130,6 +133,8 @@
6003F593195388D20070C39A /* Example for SZEasyTipView */ = {
isa = PBXGroup;
children = (
E44BB2A21D1579B7003C9E83 /* SZNavigationController.h */,
E44BB2A01D1579B2003C9E83 /* SZNavigationController.m */,
6003F59C195388D20070C39A /* SZAppDelegate.h */,
6003F59D195388D20070C39A /* SZAppDelegate.m */,
873B8AEA1B1F5CCA007FD442 /* Main.storyboard */,
Expand Down Expand Up @@ -390,6 +395,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
E44BB2A11D1579B2003C9E83 /* SZNavigationController.m in Sources */,
6003F59E195388D20070C39A /* SZAppDelegate.m in Sources */,
6003F5A7195388D20070C39A /* SZViewController.m in Sources */,
6003F59A195388D20070C39A /* main.m in Sources */,
Expand Down
10 changes: 10 additions & 0 deletions Example/SZEasyTipView.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Example/SZEasyTipView/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="7706" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="whP-gf-Uak">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="whP-gf-Uak">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<scenes>
<!--View Controller-->
Expand Down
4 changes: 4 additions & 0 deletions Example/SZEasyTipView/SZAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@
//

#import "SZAppDelegate.h"
#import "SZNavigationController.h"

@implementation SZAppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
UITableViewController *tvc = [[SZTableViewController alloc] init];
self.window.rootViewController = [[SZNavigationController alloc] initWithRootViewController:tvc];

return YES;
}

Expand Down
19 changes: 19 additions & 0 deletions Example/SZEasyTipView/SZNavigationController.h
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
79 changes: 79 additions & 0 deletions Example/SZEasyTipView/SZNavigationController.m
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
12 changes: 6 additions & 6 deletions SZEasyTipView.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand All @@ -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'

Expand Down
Empty file removed SZEasyTipView/Classes/ReplaceMe.m
Empty file.
102 changes: 102 additions & 0 deletions SZEasyTipView/Classes/SZEasyTipView.h
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
Loading

0 comments on commit c2e81d7

Please sign in to comment.