2013-08-20 72 views
2

http://i.imgur.com/lF60tKu.png影響 - Objective-C的

我有這些信件的來源,我想在Objective-C圍繞創建灰色效果。 但我不能,有沒有人有一個想法如何做到這一點?

回答

1

GSBorderLabel看看。

這很好,因爲它增加了外邊框而不是內部邊框的字符,它很容易定製它。

例如:

GSBorderLabel *myLabel = [[GSBorderLabel alloc] initWithFrame:CGRectMake(0, 50, 300, 100)]; 
myLabel.textColor = [UIColor yellowColor]; 
myLabel.textAlignment = NSTextAlignmentCenter; 
myLabel.borderColor = [UIColor grayColor]; 
myLabel.borderWidth = 20; 
myLabel.text = @"Review"; 
myLabel.font = [UIFont fontWithName:@"Party LET" size:60.0]; 

image

0

如果你的目標是iOS 6或更高版本,那麼就沒有太多的理由。您可以簡單地使用NSAttributedString將筆觸添加到現有字體。請注意,這不會將筆畫添加到字體中,只是將其呈現在屏幕上。

NSDictionary *attributes = @{NSStrokeColorAttributeName: [UIColor grayColor], NSStrokeWidthAttributeName : @3}; 

NSString *inputText = @"Some text"; 
NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:inputText attributes:attributes]; 

[self.someLabel setAttributedText:attributedString]; 
0

你可以試試這個:

#import <QuartzCore/QuartzCore.h> 

....

titleLabel.layer.shadowColor = [[UIColor grayColor] CGColor]; 
    titleLabel.layer.shadowRadius = 3; 
    titleLabel.layer.shadowOpacity = 1; 
    titleLabel.layer.shadowOffset = CGSizeMake(0, 0);