Skip to content
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
29 changes: 14 additions & 15 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
# xcode noise
*.mode1v3
# Xcode
.DS_Store
*/build/*
*.pbxuser
*.perspective
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
*.pyc
*~.nib/
build/*

# Textmate - if you build your xcode projects with it
*.tm_build_errors

# old skool
.svn

# osx noise
.DS_Store
!default.perspectivev3
xcuserdata
profile
*.moved-aside
DerivedData
.idea/
*.hmap
Binary file added Default-568h@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 12 additions & 1 deletion MTLabel.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
147737E11391B7C200BCB59A /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 147737DF1391B7C200BCB59A /* MainWindow.xib */; };
147737E41391B7C200BCB59A /* MTLabelViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 147737E31391B7C200BCB59A /* MTLabelViewController.m */; };
147737E71391B7C200BCB59A /* MTLabelViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 147737E51391B7C200BCB59A /* MTLabelViewController.xib */; };
147737EF1391B7D400BCB59A /* MTLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 147737EE1391B7D400BCB59A /* MTLabel.m */; };
147737EF1391B7D400BCB59A /* MTLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 147737EE1391B7D400BCB59A /* MTLabel.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; };
147737F11391B86600BCB59A /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 147737F01391B86600BCB59A /* CoreText.framework */; };
FA614AF41727F8FC00724B20 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FA614AF31727F8FC00724B20 /* Default-568h@2x.png */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -38,6 +39,7 @@
147737ED1391B7D400BCB59A /* MTLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTLabel.h; sourceTree = "<group>"; };
147737EE1391B7D400BCB59A /* MTLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MTLabel.m; sourceTree = "<group>"; };
147737F01391B86600BCB59A /* CoreText.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreText.framework; path = System/Library/Frameworks/CoreText.framework; sourceTree = SDKROOT; };
FA614AF31727F8FC00724B20 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -58,6 +60,7 @@
147737BE1391B7C100BCB59A = {
isa = PBXGroup;
children = (
FA614AF31727F8FC00724B20 /* Default-568h@2x.png */,
147737D31391B7C100BCB59A /* MTLabel */,
147737CC1391B7C100BCB59A /* Frameworks */,
147737CA1391B7C100BCB59A /* Products */,
Expand Down Expand Up @@ -135,6 +138,9 @@
/* Begin PBXProject section */
147737C01391B7C100BCB59A /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0460;
};
buildConfigurationList = 147737C31391B7C100BCB59A /* Build configuration list for PBXProject "MTLabel" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
Expand All @@ -160,6 +166,7 @@
147737D81391B7C200BCB59A /* InfoPlist.strings in Resources */,
147737E11391B7C200BCB59A /* MainWindow.xib in Resources */,
147737E71391B7C200BCB59A /* MTLabelViewController.xib in Resources */,
FA614AF41727F8FC00724B20 /* Default-568h@2x.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -247,7 +254,9 @@
GCC_DYNAMIC_NO_PIC = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "MTLabel/MTLabel-Prefix.pch";
GCC_VERSION = "";
INFOPLIST_FILE = "MTLabel/MTLabel-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
Expand All @@ -260,7 +269,9 @@
COPY_PHASE_STRIP = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "MTLabel/MTLabel-Prefix.pch";
GCC_VERSION = "";
INFOPLIST_FILE = "MTLabel/MTLabel-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
PRODUCT_NAME = "$(TARGET_NAME)";
VALIDATE_PRODUCT = YES;
WRAPPER_EXTENSION = app;
Expand Down
30 changes: 13 additions & 17 deletions MTLabel/MTLabel.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
// limitations under the License.

#import <UIKit/UIKit.h>

@class HAWLabel;

@protocol MTLabelDelegate
- (void)labelDidChangeFrame:(CGRect)frame;
@end
Expand All @@ -31,34 +34,21 @@ typedef enum {
} MTLabelTextAlignment;


@interface MTLabel : UIView {

int _numberOfLines;
CGFloat _lineHeight;
CGFloat _minimumFontSize;
NSString *_text;
UIColor *_fontColor, *_highlightColor;
UIFont *_font;
BOOL _limitToNumberOfLines;
BOOL _shouldResizeToFit;
MTLabelTextAlignment _textAlignment;
id<MTLabelDelegate> delegate;
BOOL adjustSizeToFit;

}
@interface MTLabel : UIView

@property (nonatomic, readwrite, setter = setNumberOfLines:, getter = numberOfLines) int _numberOfLines;
@property (nonatomic, readwrite, setter = setMaxNumberOfLines:, getter = numberOfLines) int _maxNumberOfLines;
@property (nonatomic, readwrite, setter = setLineHeight:, getter = lineHeight) CGFloat _lineHeight;
@property (nonatomic, readonly) CGFloat _textHeight;
@property (nonatomic, readwrite, setter = setMinimumFontSize:, getter = minimumFontSize) CGFloat _minimumFontSize;
@property (nonatomic, retain, setter = setText:, getter = text) NSString *_text;
@property (nonatomic, retain, setter = setFontColor:, getter = fontColor) UIColor *_fontColor;
@property (nonatomic, retain, setter = setTextColor:, getter = fontColor) UIColor *_textColor;
@property (nonatomic, retain, setter = setFontHighlightColor:, getter = fontHighlightColor) UIColor *_fontHighlightColor;
@property (nonatomic, retain, setter = setFont:, getter = font) UIFont *_font;
@property (nonatomic, readwrite, setter = setLimitToNumberOfLines:, getter = limitToNumberOfLines) BOOL _limitToNumberOfLines;
@property (nonatomic, readwrite, setter = setResizeToFitText:, getter = resizeToFitText) BOOL _shouldResizeToFit;
@property (nonatomic, readwrite, setter = setTextAlignment:, getter = textAlignment) MTLabelTextAlignment _textAlignment;
@property (nonatomic, assign) id<MTLabelDelegate> delegate;
@property (nonatomic, weak) id<MTLabelDelegate> delegate;
@property (nonatomic, readwrite, setter = setAdjustSizeToFit:, getter = adjustSizeToFit) BOOL _adjustSizeToFit;

@property (nonatomic, readwrite) CGFloat shadowOffset;
Expand All @@ -85,5 +75,11 @@ typedef enum {
-(BOOL)resizeToFitText;
-(MTLabelTextAlignment)textAlignment;

- (CGFloat)labelBottomMargin;
- (CGFloat)labelTopMargin;
- (CGFloat)positionBelowLabel:(HAWLabel *)label offset:(CGSize)offset;
- (CGFloat)positionBelowView:(UIView *)view offset:(CGSize)offset;
- (CGFloat)positionBelowMTLabel:(MTLabel *)label offset:(CGSize)offset;
- (CGFloat)layoutHeight;

@end
Loading