UIBarButtonItemã®è²ãå¤æ´ããæ¹æ³
UIToolBarã«è¨ç½®ãããã¿ã³ã®è²ãå¤æ´ãããå ´åããããã¨æãã¾ããè²ã®å¤æ´ã¯UINavigationBarãªã©ã¨åæ§ãtintColorã§ããã£ã¨ã§ããã ããã¨æãããAPIã«ã¢ã¯ã»ã¹ã§ãã¾ããã
CustomViewã§ç»åãå©ç¨ãããã¿ã³ã表示ããæ¹æ³ãªã©ãããã¾ãããä¸è¨ã®ããã«ããã°tintColorãå©ç¨ãããã¨ãã§ãã¾ãã
// Toolbarçæ UIToolbar *toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 460-44, 320, 44)]; toolbar.barStyle = UIBarStyleBlackTranslucent; [self.view addSubview:toolbar]; UIBarButtonItem *button1 = [[UIBarButtonItem alloc] initWithTitle:@"Button" style:UIBarButtonItemStyleBordered target:self action:@selector(action)]; UIBarButtonItem *button2 = [[UIBarButtonItem alloc] initWithTitle:@"Button" style:UIBarButtonItemStyleBordered target:self action:@selector(action)]; UIBarButtonItem *button3 = [[UIBarButtonItem alloc] initWithTitle:@"Button" style:UIBarButtonItemStyleBordered target:self action:@selector(action)]; NSArray *items = [NSArray arrayWithObjects:button1, button2, button3, nil]; [toolbar setItems:items]; [button1 release]; [button2 release]; [button3 release]; // æå¾ã®ãã¿ã³ã®è²å¤æ´ UIView *v = [[toolbar subviews] lastObject]; if([v respondsToSelector:@selector(setTintColor:)]){ [v performSelector:@selector(setTintColor:) withObject:[UIColor redColor]]; }