0

我有一个自定义导航栏,当它针对 iphone 5 展开时,我想将其固定在屏幕底部。我只知道如何在 IB 中正确执行此操作,并且从开发人员那里继承了代码,

我试过了:

ICNavbarView *navBarView = [[ICNavbarView alloc] init];
navBarView.delegate = self;
CGRect navBarFrame = navBarView.frame;
navBarFrame.origin.y = self.view.frame.size.height - navBarFrame.size.height;
navBarView.frame = navBarFrame;
[self.view addSubview:navBarView];

////////resize/metrics of Navbar////////
[navBarView setAutoresizingMask:(UIViewAutoresizingFlexibleBottomMargin |     UIViewAutoresizingFlexibleWidth)];

导航栏不会让步!我是否错过了一种在不调整大小的情况下随屏幕向下移动导航栏的方法?

4

1 回答 1

1

改变这个:

[navBarView setAutoresizingMask:(UIViewAutoresizingFlexibleBottomMargin |     UIViewAutoresizingFlexibleWidth)];

到:

[navBarView setAutoresizingMask:(UIViewAutoresizingFlexibleTopMargin |     UIViewAutoresizingFlexibleWidth)];
于 2012-09-29T20:47:23.923 回答