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
4 changes: 4 additions & 0 deletions WTagList.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
04DEC62915A8988A0034CA79 /* WTagList.m in Sources */ = {isa = PBXBuildFile; fileRef = 04DEC62815A8988A0034CA79 /* WTagList.m */; };
04DEC62B15A898EF0034CA79 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 04DEC62A15A898EF0034CA79 /* QuartzCore.framework */; };
2D195BD416FBAC890069A5E3 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 2D195BD316FBAC890069A5E3 /* Default-568h@2x.png */; };
5C2E58911E1E45DD00B777F5 /* img_delete.png in Resources */ = {isa = PBXBuildFile; fileRef = 5C2E58901E1E45DD00B777F5 /* img_delete.png */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -40,6 +41,7 @@
04DEC62815A8988A0034CA79 /* WTagList.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WTagList.m; sourceTree = "<group>"; };
04DEC62A15A898EF0034CA79 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
2D195BD316FBAC890069A5E3 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
5C2E58901E1E45DD00B777F5 /* img_delete.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = img_delete.png; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -115,6 +117,7 @@
04DEC62615A8988A0034CA79 /* Classes */ = {
isa = PBXGroup;
children = (
5C2E58901E1E45DD00B777F5 /* img_delete.png */,
04DEC62715A8988A0034CA79 /* WTagList.h */,
04DEC62815A8988A0034CA79 /* WTagList.m */,
);
Expand Down Expand Up @@ -174,6 +177,7 @@
files = (
04DEC61115A897B80034CA79 /* InfoPlist.strings in Resources */,
04DEC61D15A897B80034CA79 /* ViewController_iPhone.xib in Resources */,
5C2E58911E1E45DD00B777F5 /* img_delete.png in Resources */,
04DEC62015A897B80034CA79 /* ViewController_iPad.xib in Resources */,
2D195BD416FBAC890069A5E3 /* Default-568h@2x.png in Resources */,
);
Expand Down
21 changes: 14 additions & 7 deletions WTagList/Classes/WTagList.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,24 @@
#import "WTagList.h"
#import <QuartzCore/QuartzCore.h>

#define CORNER_RADIUS 10.0f
#define CORNER_RADIUS 2.0f
#define LABEL_MARGIN_DEFAULT 5.0f
#define BOTTOM_MARGIN_DEFAULT 5.0f
#define FONT_SIZE_DEFAULT 13.0f
#define HORIZONTAL_PADDING_DEFAULT 7.0f
#define VERTICAL_PADDING_DEFAULT 3.0f
#define BACKGROUND_COLOR [UIColor colorWithRed:0.93 green:0.93 blue:0.93 alpha:1.00]
#define BACKGROUND_COLOR [UIColor colorWithRed:161/255.0 green:170/255.0 blue:201/255.0 alpha:1.00]
#define TEXT_COLOR [UIColor blackColor]
#define TEXT_SHADOW_COLOR [UIColor whiteColor]
#define TEXT_SHADOW_OFFSET CGSizeMake(0.0f, 1.0f)
#define BORDER_COLOR [UIColor lightGrayColor].CGColor
#define BORDER_WIDTH 1.0f
#define BORDER_WIDTH 0.0f
//#define HIGHLIGHTED_BACKGROUND_COLOR [UIColor colorWithRed:0.40 green:0.80 blue:1.00 alpha:0.5]
#define DEFAULT_AUTOMATIC_RESIZE NO

#define IMG_WIDTH_HEIGHT 18
#define IMGNAME @"img_delete.png"

@interface WTagList()

@property (nonatomic, assign) BOOL isTagsSettingUp;
Expand Down Expand Up @@ -367,6 +370,8 @@ - (id)initForList:(WTagList *)parentList {
_label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
[_label setBackgroundColor:[UIColor clearColor]];
[_label setTextAlignment:NSTextAlignmentCenter];


[self addSubview:_label];

_button = [UIButton buttonWithType:UIButtonTypeCustom];
Expand All @@ -391,8 +396,8 @@ -(void)applyParentTheme {
self.backgroundColor = self.parentList.defaultBackgroundColor;

self.textColor = self.parentList.defaultTextColor;
self.textShadowColor = self.parentList.defaultTextShadowColor;
self.textShadowOffset = self.parentList.defaultTextShadowOffset;
//self.textShadowColor = self.parentList.defaultTextShadowColor;
//self.textShadowOffset = self.parentList.defaultTextShadowOffset;

self.cornerRadius = self.parentList.defaultCornerRadius;
self.borderColor = self.parentList.defaultBorderColor.CGColor;
Expand All @@ -410,9 +415,11 @@ -(void)setText:(NSString *)text {
textSize.width = MAX(textSize.width, minimumTextWidth);
textSize.height += self.parentList.verticalPadding*2;

self.frame = CGRectMake(0, 0, textSize.width+self.parentList.horizontalPadding*2, textSize.height);
self.frame = CGRectMake(0, 0, textSize.width+self.parentList.horizontalPadding*2 + IMG_WIDTH_HEIGHT+2.0, textSize.height);
self.label.frame = CGRectMake(self.parentList.horizontalPadding, 0, MIN(textSize.width, self.frame.size.width), textSize.height);

UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:IMGNAME]];
imgView.frame = CGRectMake(textSize.width+self.parentList.horizontalPadding, (textSize.height - IMG_WIDTH_HEIGHT)*0.5, IMG_WIDTH_HEIGHT, IMG_WIDTH_HEIGHT);
[_label addSubview:imgView];
[_button setAccessibilityLabel:self.label.text];
}

Expand Down
Binary file added WTagList/Classes/img_delete.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.