UIToolBar 添加任意的视图 方法

来源:互联网 发布:道士红毒和绿毒数据 编辑:程序博客网 时间:2024/05/05 09:42
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 44)];    label.font=[UIFont systemFontOfSize:16];    label.backgroundColor = [UIColor whiteColor];    label.textAlignment=UITextAlignmentCenter;    label.text  = @"testlabel";  UIBarButtonItem *buttonItem = [[UIBarButtonItem alloc]initWithCustomView:label];   NSArray *itemArray = [NSArray arrayWithObjects:buttonItem, nil];[self.navigationController.toolbar setItems:itemArray animated:YES];

原创粉丝点击