iOS UIToolBar

2019-01-07  本文已影响27人  CaptainRoy
屏幕快照 2019-01-07 下午3.56.48.png
UIToolbar *tool = [[UIToolbar alloc] initWithFrame:CGRectMake(0.0f, 40.0f, self.view.frame.size.width, 40.0f)];
    
    tool.barStyle = UIBarStyleDefault;
    tool.backgroundColor = [UIColor orangeColor];
    
    UIBarButtonItem *cancelItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:NULL];
    
    UIBarButtonItem *confirmItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:NULL];
    
    UIBarButtonItem *spaceItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:NULL];
    
    UIBarButtonItem *addItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCamera target:NULL action:NULL];
    addItem.enabled = NO;
    
    [tool setItems:@[cancelItem,spaceItem,confirmItem,spaceItem,addItem]];
    
    [self.view addSubview:tool];
上一篇下一篇

猜你喜欢

热点阅读