barStyle
解説
ツールバーのスタイル
フレームワーク
UIKit
クラス
UIToolbar
Property
使用可能
iPhone2.0
参照
例文
- (void)applicationDidFinishLaunching:(UIApplication *)application { //ツールバーを作る CGRect toolbarRect = CGRectMake(0, 431, 320, 49); UIToolbar *aToolbar = [[UIToolbar alloc] initWithFrame:toolbarRect]; self.toolbar = aToolbar; [aToolbar release]; [window addSubview:toolbar]; //ツールバーアイテムを作る UIBarButtonItem *leftItem = [[UIBarButtonItem alloc] initWithTitle:LocStr(@"001",@"left") style:UIBarButtonItemStyleBordered target:self action:@selector(toggleRun:)]; leftItem.width = 150.0; [ leftItem setTarget : self ]; [ leftItem setAction : @selector( leftAction: ) ]; //右ビュー UIBarButtonItem *rightItem = [[UIBarButtonItem alloc] initWithTitle:LocStr(@"002","right") style:UIBarButtonItemStyleBordered target:self action:@selector(toggleFiltering:)]; rightItem.width = 150.0; [ rightItem setTarget : self ]; [ rightItem setAction : @selector( rightAction: ) ]; //配列を作る NSArray *items = [NSArray arrayWithObjects:leftItem, rightItem, nil]; [leftItem release]; [rightItem release]; //ツールバーにセットする [toolbar setItems:items animated:YES]; aToolbar.barStyle = UIBarStyleDefault; switch (aToolbar.barStyle) { case UIBarStyleDefault: NSLog(@"UIBarStyleDefault"); break; case UIBarStyleBlack: NSLog(@"UIBarStyleBlack"); break; case UIBarStyleBlackTranslucent: NSLog(@"UIBarStyleBlackTranslucent"); break; default: break; } [window makeKeyAndVisible]; }