UILabel
プログラムで自分に追加しようとしてUIToolBar
いますが、表示されていないようです。これは私が自分のコードで行っていることです。
- (void) viewWillAppear:(BOOL)animated
{
// Create custom toolbar at top of screen under navigation controller
[matchingSeriesInfoToolBar setFrame:CGRectMake(0, 60, 320, 30)];
matchingSeriesInfoToolBar = [UIToolbar new];
[matchingSeriesInfoToolBar sizeToFit];
CGFloat toolbarHeight = 30;
CGRect mainViewBounds = [[UIScreen mainScreen] applicationFrame];
[matchingSeriesInfoToolBar setFrame:CGRectMake(CGRectGetMinX(mainViewBounds), 0, CGRectGetWidth(mainViewBounds), toolbarHeight)];
matchingSeriesInfoToolBar.tintColor = [UIColor darkGrayColor];
[self.view addSubview:matchingSeriesInfoToolBar];
// Create size of uitableview (to fit toolbar.
[matchingSeriesTableView setFrame:CGRectMake(0, 30, self.view.frame.size.width, self.view.frame.size.height - 30)];
[self.view addSubview:matchingSeriesTableView];
// Ad UILabel to the toolbar
UIBarButtonItem *textFieldItem = [[UIBarButtonItem alloc] initWithCustomView:manufSelectionLabel];
matchingSeriesInfoToolBar.items = [NSArray arrayWithObject:textFieldItem];
manufSelectionLabel.text = @"Hello World!";
[super viewWillAppear:animated];
}
画面の下部から通常の場所を変更して、の下に表示されるカスタムツールバーを作成しましたUINavigationController
。これもこのようにビューに追加されるため、ビューの遷移で適切にアニメーション化されます。
その後、カスタムツールバーの後に表示されるようにテーブルビューのサイズを作成します。
次に、そこからツールバーにを追加しようとしてUILabel
いますが、何らかの理由で機能しません。
どんな助けでも大歓迎です。