Mar*_*cke 6 user-interface uinavigationbar ios ios7 ios8
简单的问题:如何增加导航栏的高度,以便在保持模糊的同时使用其他小部件?
例如日历应用程序,其中工作日缩写添加到导航栏的底部...

...当您将邮件移动到另一个文件夹时,在Mail中:

由于iAnurag帖子ans是正确的但仍有一些ui问题(宽度不合适)
码
#import "ViewController.h"
@implementation UINavigationBar (customNav)
- (CGSize)sizeThatFits:(CGSize)size {
CGRect rec = self.frame;
CGRect screenRect = [[UIScreen mainScreen] bounds];
rec.size.width = screenRect.size.width;
rec.size.height = 70;
return rec.size;
}
@end
Run Code Online (Sandbox Code Playgroud)
产量
When press on "Button"

https://developer.apple.com/library/prerelease/content/samplecode/NavBar/Introduction/Intro.html
来自ReadMe.md:
扩展导航栏####此示例演示如何以视图的方式在导航栏下方放置自定义视图似乎是导航栏本身的一部分.此技术可用于创建类似于iOS日历应用程序的界面.
我不谦虚的意见:不要覆盖sizeThatFits(_:),不要在导航栏高度上设置约束.从上面的例子中做出错觉.
创建一个具有自定义 sizeThatFits 的 UINavigationBar 类别。
@implementation UINavigationBar (customNav)
- (CGSize)sizeThatFits:(CGSize)size
{
CGSize newSize = CGSizeMake(self.frame.size.width,70);
return newSize;
}
@end
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3059 次 |
| 最近记录: |