Merge pull request #24 from NativeScript/hhristov/tnsp

Move UILabel extend from modules to widgets
This commit is contained in:
Hristo Hristov
2016-06-13 12:39:28 +03:00
committed by GitHub
5 changed files with 56 additions and 2 deletions

4
.gitignore vendored
View File

@@ -43,4 +43,6 @@ gradle/
# OS-specific files # OS-specific files
.DS_Store .DS_Store
.DS_Store? .DS_Store?
ios/TNSWidgets/TNSWidgets.xcodeproj/project.xcworkspace/xcuserdata/
ios/TNSWidgets/TNSWidgets.xcodeproj/xcuserdata/

View File

@@ -7,6 +7,8 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
8B7321CF1D097ECD00884AC6 /* TNSLabel.h in Headers */ = {isa = PBXBuildFile; fileRef = 8B7321CD1D097ECD00884AC6 /* TNSLabel.h */; settings = {ATTRIBUTES = (Public, ); }; };
8B7321D01D097ECD00884AC6 /* TNSLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B7321CE1D097ECD00884AC6 /* TNSLabel.m */; };
F98F5CB31CD0EFEA00978308 /* TNSWidgets.h in Headers */ = {isa = PBXBuildFile; fileRef = F98F5CB21CD0EFEA00978308 /* TNSWidgets.h */; settings = {ATTRIBUTES = (Public, ); }; }; F98F5CB31CD0EFEA00978308 /* TNSWidgets.h in Headers */ = {isa = PBXBuildFile; fileRef = F98F5CB21CD0EFEA00978308 /* TNSWidgets.h */; settings = {ATTRIBUTES = (Public, ); }; };
F98F5CBA1CD0EFEA00978308 /* TNSWidgets.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F98F5CAF1CD0EFEA00978308 /* TNSWidgets.framework */; }; F98F5CBA1CD0EFEA00978308 /* TNSWidgets.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F98F5CAF1CD0EFEA00978308 /* TNSWidgets.framework */; };
F98F5CBF1CD0EFEA00978308 /* TNSWidgetsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F98F5CBE1CD0EFEA00978308 /* TNSWidgetsTests.m */; }; F98F5CBF1CD0EFEA00978308 /* TNSWidgetsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F98F5CBE1CD0EFEA00978308 /* TNSWidgetsTests.m */; };
@@ -25,6 +27,8 @@
/* End PBXContainerItemProxy section */ /* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
8B7321CD1D097ECD00884AC6 /* TNSLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TNSLabel.h; sourceTree = "<group>"; };
8B7321CE1D097ECD00884AC6 /* TNSLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TNSLabel.m; sourceTree = "<group>"; };
F98F5CAF1CD0EFEA00978308 /* TNSWidgets.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = TNSWidgets.framework; sourceTree = BUILT_PRODUCTS_DIR; }; F98F5CAF1CD0EFEA00978308 /* TNSWidgets.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = TNSWidgets.framework; sourceTree = BUILT_PRODUCTS_DIR; };
F98F5CB21CD0EFEA00978308 /* TNSWidgets.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TNSWidgets.h; sourceTree = "<group>"; }; F98F5CB21CD0EFEA00978308 /* TNSWidgets.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TNSWidgets.h; sourceTree = "<group>"; };
F98F5CB41CD0EFEA00978308 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; F98F5CB41CD0EFEA00978308 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -76,6 +80,8 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
F98F5CB21CD0EFEA00978308 /* TNSWidgets.h */, F98F5CB21CD0EFEA00978308 /* TNSWidgets.h */,
8B7321CD1D097ECD00884AC6 /* TNSLabel.h */,
8B7321CE1D097ECD00884AC6 /* TNSLabel.m */,
F98F5CC91CD0F09E00978308 /* UIImage+TNSBlocks.h */, F98F5CC91CD0F09E00978308 /* UIImage+TNSBlocks.h */,
F98F5CCA1CD0F09E00978308 /* UIImage+TNSBlocks.m */, F98F5CCA1CD0F09E00978308 /* UIImage+TNSBlocks.m */,
F98F5CB41CD0EFEA00978308 /* Info.plist */, F98F5CB41CD0EFEA00978308 /* Info.plist */,
@@ -101,6 +107,7 @@
files = ( files = (
F98F5CB31CD0EFEA00978308 /* TNSWidgets.h in Headers */, F98F5CB31CD0EFEA00978308 /* TNSWidgets.h in Headers */,
F98F5CCB1CD0F09E00978308 /* UIImage+TNSBlocks.h in Headers */, F98F5CCB1CD0F09E00978308 /* UIImage+TNSBlocks.h in Headers */,
8B7321CF1D097ECD00884AC6 /* TNSLabel.h in Headers */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@@ -200,6 +207,7 @@
isa = PBXSourcesBuildPhase; isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
8B7321D01D097ECD00884AC6 /* TNSLabel.m in Sources */,
F98F5CCC1CD0F09E00978308 /* UIImage+TNSBlocks.m in Sources */, F98F5CCC1CD0F09E00978308 /* UIImage+TNSBlocks.m in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;

View File

@@ -0,0 +1,16 @@
//
// TNSLabel.h
// TNSWidgets
//
// Created by Hristo Hristov on 6/9/16.
// Copyright © 2016 Telerik A D. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface TNSLabel : UILabel
@property(nonatomic) UIEdgeInsets padding;
@property(nonatomic) UIEdgeInsets borderThickness;
@end

View File

@@ -0,0 +1,28 @@
//
// TNSLabel.m
// TNSWidgets
//
// Created by Hristo Hristov on 6/9/16.
// Copyright © 2016 Telerik A D. All rights reserved.
//
#import "TNSLabel.h"
@implementation TNSLabel
- (CGRect)textRectForBounds:(CGRect)bounds limitedToNumberOfLines:(NSInteger)numberOfLines {
CGSize size = [super textRectForBounds:bounds limitedToNumberOfLines:numberOfLines].size;
return CGRectMake(
- (self.borderThickness.left + self.padding.left),
- (self.borderThickness.right + self.padding.right),
size.width + self.borderThickness.left + self.padding.left + self.padding.right + self.borderThickness.right,
size.height + self.borderThickness.top + self.padding.top + self.padding.bottom + self.borderThickness.bottom
);
}
-(void)drawTextInRect:(CGRect)rect {
[super drawTextInRect:UIEdgeInsetsInsetRect(UIEdgeInsetsInsetRect(rect, self.borderThickness), self.padding)];
}
@end

View File

@@ -17,4 +17,4 @@ FOUNDATION_EXPORT const unsigned char TNSWidgetsVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <TNSWidgets/PublicHeader.h> // In this header, you should import all the public headers of your framework using statements like #import <TNSWidgets/PublicHeader.h>
#import "UIImage+TNSBlocks.h" #import "UIImage+TNSBlocks.h"
#import "TNSLabel.h"