1

iOSで複数行のナビゲーション/トップバーを作成する方法について誰かが手がかりを持っていますか?WhatsAppのステータス行(最後に表示されたものまたは現在のステータス情報を表示するもの)に似たものが必要です。何かアドバイスをいただければ幸いです。

画像のようなものを実現したい(Francis Whitman /最後に見た[...]):

ここに画像の説明を入力してください

4

2 に答える 2

3

デフォルトでは、ナビゲーション バーのタイトルに現在表示されているビュー コントローラのプロパティUINavigationControllerが使用されます。ただし、 View Controller のプロパティのプロパティを次のようtitleに設定することで、任意のビューを表示させることができます。titleViewnavigationItem

// In your view controller’s implementation (.m) file:
- (id)initWithNibName:(NSString *)nibName
               bundle:(NSStirng *)nibBundle
{
    self = [super initWithNibName:nibName bundle:nibBundle];

    if (self) {
        UIView *myTitleView = [[UIView alloc] initWithFrame:CGRectMake(0.0f,
                                                                       0.0f,
                                                                       250.0f,
                                                                       44.0f)];
        [myView setBackgroundColor:[UIColor greenColor]];

        [[self navigationItem] setTitleView:myTitleView];
    }

    return self;
}
于 2012-07-08T18:08:39.570 に答える
0
UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width/2, 200)];
[label setBackgroundColor:[UIColor clearColor]];
[label setTextColor:[UIColor whiteColor]];
[label setTextAlignment:NSTextAlignmentCenter];
[label setNumberOfLines:0];
[label setText:_certificate.name];
self.navigationItem.titleView = label;
于 2015-11-04T08:02:56.297 に答える