2

を使用してカスタムフォントと色のプロパティを持つように UIBarButtonItem を調整しました

self.followButton = [[[UIBarButtonItem alloc]

                             initWithTitle: NSLocalizedString(@"TWITTER_FOLLOW_BUTTON_TEXT", nil)
                             style:UIBarButtonItemStylePlain
                             target:self
                             action:@selector(handleFollowButtonPressed:)]
                            autorelease];  

[self.followButton setBackgroundImage:[UIImage new] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];  

[followButton setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys: [UIFont fontWithName:@"Helvetica" size:14.0], UITextAttributeFont,nil] forState:UIControlStateNormal];  

NSDictionary *attributes = @{UITextAttributeTextColor : [UIColor colorWithRed:1 green:0.176 blue:0.333 alpha:1 /*#ff2d55*/ ]};

    [followButton setTitleTextAttributes:attributes
                            forState:UIControlStateNormal]; 

の外観を取得するには

ここに画像の説明を入力

ボタン項目のテキストの影を画像に変更することなく削除するにはどうすればよいですか?

4

2 に答える 2

3

または、 UITextAttributeTextShadowColor を [UIColor clearColor] に設定することもできます

@{UITextAttributeTextShadowColor : [UIColor clearColor]}
于 2013-06-26T00:56:48.527 に答える