热到自定义导航栏出现在UITabBarController的"更多"选项卡上,以2 px线(不同颜色)作为底部边框?
我创建了UINavigationBar的子类,它覆盖了drawrect:方法并绘制了该行,并且适用于前四个选项卡,除了更多导航控制器下的选项卡.
有帮助吗?

你好,
我创建了UINavigationBar,我尝试将颜色条更改为浅绿色(如Nib文件中所示)
我该怎么做?
我已经将UINavigationbar和UIscrollView添加到UIView(SecondView).当我在firstView中单击一个按钮时,它应该带我到secondView.点击按钮:
SecondView *secondview=[[SecondView alloc]initWithNibName:@"SecondView" bundle:nil];
[self presentModalViewController: secondview animated:NO]; //error at this line
[secondview release];
Run Code Online (Sandbox Code Playgroud)
在secondView.h中
@property(nonatomic,retain)IBOutlet UINavigationBar *navigationBar;
@property(nonatomic,retain)IBOutlet UIScrollView *testscroll;
Run Code Online (Sandbox Code Playgroud)
SecondView.m:
@synthesize navigationBar,testscroll;
Run Code Online (Sandbox Code Playgroud)
但我得到的错误如下:
由于未捕获的异常'NSUnknownKeyException'而终止应用程序,原因:SecondView setValue:forUndefinedKey:]:此类不是键值navigationBar的键值编码兼容.
我的secondView.xib是这样的:
无法理解我哪里出错了?
想要隐藏后退按钮导航栏,我已经尝试了以下所有语句,但它们都没有为我工作
[self.navigationController.navigationItem setHidesBackButton:YES]; //1
[self.navigationController.navigationBar.backItem setHidesBackButton:YES]; //2
self.navigationController.navigationItem.hidesBackButton = TRUE; //3
[self.navigationItem setHidesBackButton:YES animated:YES]; //4
self.navigationItem.hidesBackButton = NO; //5
Run Code Online (Sandbox Code Playgroud) 我希望UIStatusBar在我的应用程序中设置背景颜色,我希望它匹配的背景颜色,和应用程序UINavigationBar相同.FacebookInstagram
我尝试将此函数添加到didFinishLaunchingWithOptions我的方法中AppDelegate:
-(void) setStatusBarColour{
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0"))
{
UIView *view=[[UIView alloc] initWithFrame:CGRectMake(0, 0,self.window.rootViewController.view.frame.size.width, 20)];
view.backgroundColor=[[UIColor lightGrayColor] colorWithAlphaComponent:0.6];
[self.window.rootViewController.view addSubview:view];
}
}
Run Code Online (Sandbox Code Playgroud)
它似乎没有工作.
是否有捷径可寻?
我想做的是改变后退按钮的高度.但是,据我所知,改变的唯一选择是宽度.所以,我以为我会创建一个带有我自己的小图像的自定义后退按钮.现在我使用viewDidLoad方法完成了这个,代码如下:
//Setup navigation bar
navigationController?.navigationItem.backBarButtonItem = UIBarButtonItem(image:UIImage(named:"back_arrow.png"), style:UIBarButtonItemStyle.Plain, target:nil, action:nil)
navigationController?.navigationItem.backBarButtonItem!.title = ""
Run Code Online (Sandbox Code Playgroud)
但是,后退按钮保持蓝色,大,并且标题为"后退".如何才能使此代码正常工作?调试器说它正在运行,但它没有改变任何东西.
我想将默认的backBarButtonItem颜色更改为白色,
我的代码如下所示
self.navigationItem.backBarButtonItem?.tintColor = UIColor.whiteColor()
Run Code Online (Sandbox Code Playgroud)
但它不适合我,任何想法?
uinavigationbar uinavigationcontroller uinavigationitem backbarbuttonitem swift
我制作了一个标准的Master-Detail应用程序(使用Xcode模板).我修改了它,现在当我单击第一个表视图的一个单元格时,应用程序显示另一个表视图(这是详细信息,因为它被单击的单元格值过滤).在标准表视图中,我会在UINavigationBar上出现这种情况:
Edit Table title + (for adding new items)
我也需要UINavigationBar的默认后退按钮.有可能并允许这样做吗?图形上它会是这样的:
< Back Table title Edit +
你知道任何其他布局在顶部栏中显示3个按钮(后退 - 编辑 - 添加)加上标题吗?
很抱歉没有发布图片,提前致谢.
PS我想知道是否可以使用内置后退按钮和编辑按钮(我的意思是系统自动将其放入导航栏)进行操作.
我试图在我的UINavigationBar中设置标题颜色AppDelegate.swift,像这样 -
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
UINavigationBar.appearance().barTintColor = UIColor(red: 26.0/255.0, green: 188.0/255.0, blue: 156.0/255.0, alpha: 1.0)
UINavigationBar.appearance().tintColor = UIColor(red: 255.0/255.0, green: 255.0/255.0, blue: 255.0/255.0, alpha: 1.0)
UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName: UIColor.white]
UINavigationBar.appearance().titleTextAttributes = [NSFontAttributeName: UIFont(name: "Pacifico", size: 24)!]
// Turquoise color rgba(26, 188, 156,1.0)
return true
}
Run Code Online (Sandbox Code Playgroud)
我正在使用我们所有人的已知动画,动画更改导航栏的背景图像,延迟时间将其从半透明(我将其设为默认值)更改为(蓝色主题).
UIView.animate(withDuration:0.5,
delay: 0,
option: UIViewAnimationOptions.curveEaseOut,
animations: {
self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
self.navigationController?.navigationBar.shadowImage = UIImage()
}, completion: nil)
Run Code Online (Sandbox Code Playgroud)
但动画没有用,但导航栏的背景图像改变成功,我不知道为什么!!
有任何想法吗?
uinavigationbar ×10
ios ×7
iphone ×3
objective-c ×3
swift ×2
swift3 ×2
xcode ×2
colors ×1
ios6 ×1
ios7 ×1
uicolor ×1
uistatusbar ×1