私の解決策:
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button addTarget:self action:@selector(changeMapViewButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
[button setFrame:CGRectMake(0, 0, 50, 30)];
[button setTitle:@"3D" forState:UIControlStateNormal];
[button setTitleColor:self.view.tintColor forState:UIControlStateNormal];
[button setTitle:@"3D" forState:UIControlStateHighlighted];
[button setTitleColor:[self.view.tintColor colorWithAlphaComponent:0.15] forState:UIControlStateHighlighted];
[button.titleLabel setFont:[UIFont fontWithName:@"HelveticaNeue-Thin" size:25]];
UIBarButtonItem *changeMapViewItem = [[UIBarButtonItem alloc] initWithCustomView:button];
これは次のようになります。
私はそれを試しました:
UIBarButtonItem *changeMapViewItem = [[UIBarButtonItem alloc] initWithTitle:@"3D" style:UIBarButtonItemStylePlain target:self action:@selector(changeMapViewButtonPressed:)];
[changeMapViewItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont fontWithName:@"HelveticaNeue-Thin" size:25], NSFontAttributeName,nil] forState:UIControlStateNormal];
しかし、Text は UIToolbar のアイコンと一致しません。
HTH ドミニク