Set Button with Title and Shadow at Bottom of the Button

i have a Button that looks like this:

The Button has always the same Size, a title and a Shadow at the bottom of the button for better reading.

At the Moment i use this Code:

 self.button = [GTButton buttonWithType:UIButtonTypeCustom];
 self.button = [[GTButton alloc]initWithFrame:CGRectMake(0, 0, 156, 156)];

 self.button.exclusiveTouch = YES;

 //Create Shadow
 UILabel *shadowLabel = [[UILabel alloc] initWithFrame:CGRectMake(0.0, 120.0f, 156.0f, 36.0f)];

 shadowLabel.backgroundColor = GTDefaultShadowColorTiles;

 self.button.titleLabel.numberOfLines = 0;
 self.button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
 self.button.contentVerticalAlignment = UIControlContentVerticalAlignmentBottom;
[self.button setTitle:@"SHOPPING" forState:UIControlStateNormal];

 [self.button addSubview:shadowLabel];
 [self addSubview:self.button];

You can see i´m using a Label with black Color and 50% transparency (GTDefaultShadowColorTiles) which i add on the Button!

Now i have the following Problems:

First Problem:

As you can see, the Label is on top of the Button and so the Button Title is behind the shadow and not really readable. Is there a better way for setting a Shadow on the Bottom?

Second Problem:

The title should be always centered horizontally and vertically in the Shadow! How can ich achieve this? At the Moment the Title Alignment is orientating on the whole Button frame not only on the Shadow!

Answers


Ok i finally solved my Probem, i´m not using the Button Title anymore but i put the Text into the Label (can´t belive that is missed that):

    self.shadowLabel = [[UILabel alloc] initWithFrame:CGRectMake(0.0, 120.0f, 156.0f, 36.0f)];

    self.shadowLabel.backgroundColor = GTDefaultShadowColorTiles;

    self.shadowLabel.textAlignment = UIControlContentVerticalAlignmentCenter;
    self.shadowLabel.textAlignment = UIControlContentHorizontalAlignmentCenter;
    self.shadowLabel.textAlignment = NSTextAlignmentCenter;
    self.shadowLabel.numberOfLines = 3;


    self.shadowLabel.text = @"SHOPPING";

    [self.button addSubview:self.shadowLabel];
    [self addSubview:self.button];

Need Your Help

Pass progress bar through async.series - nodeJs

javascript node.js asynchronous progress

Right im trying to get progress from a list of tasks run through async series