Tag: uinavigationbar

UINavigationBar:拦截后退button和后滑动手势

我有一个UINavigationBar,截获后退button,提醒用户是否有更改。 这是基于在UINavigationController和UINavigationBarDelegate.ShouldPopItem()中使用UINavigationBarDelegate协议和实现- (BOOL)navigationBar:(UINavigationBar *)navigationBar shouldPopItem:(UINavigationItem *)item; 现在,iOS7已经引入了滑回手势,我也想拦截它,但无法使用到目前为止我find的解决scheme,即使用[self.interactivePopGestureRecognizer addTarget:self action:@selector(handlePopGesture:)]; 和 – (void)handlePopGesture:(UIGestureRecognizer *)gesture { if (gesture.state == UIGestureRecognizerStateEnded) { [self popViewControllerAnimated:NO]; } } 虽然这确实popup的意见,它留下的导航栏button,所以我结束了一个后退button,无处不在,以及我已经添加到导航栏的所有其他导航button。 有小费吗?

iOS 7导航栏背景图像的问题

我正在使用图像作为导航栏背景图片。 设置图片我使用下面的代码: [[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"nav_logo_ios7.png"] forBarMetrics:UIBarMetricsDefault]; 对于iOS7“nav_logo_ios7.png”图片大小为768×64,对于iOS6和波纹pipe,我使用的图片大小为768×44。 这在所有的UIViewControllers上都能正常工作。 在同一个项目中我使用UIActivityViewController 。 在iOS7邮件撰写视图看起来像这样: 我该如何处理? 提前致谢。

如何更改UINavigationBar中的UIBarButtonItems之间的空间?

这是现在的样子: 这是如何在debugging视图层次结构中表示的: 以下是我如何在代码中设置它: func setupUserAndCartButtons() { var rightBarButtonItems = [UIBarButtonItem]() let cartBarButtonItem = UIBarButtonItem(image: DBCart.sharedCart().icon, style: .Plain, target: self, action: Selector("cartButtonTapped:")) rightBarButtonItems.append(cartBarButtonItem) let userIcon = UIImage(named: "icon-user") let userBarButtonItem = UIBarButtonItem(image: userIcon, style: .Plain, target: self, action: Selector("userButtonTapped:")) rightBarButtonItems.append(userBarButtonItem) navigationItem.rightBarButtonItems = rightBarButtonItems } 如果不使用自定义视图,可以将它们彼此靠得更近?

防止UINavigationBar popViewControlleranimation

我有以下问题:我已经覆盖popViewControllerAnimated:(BOOL)animated的UINavigationController因为我想有一个自定义的animation。 代码如下: – (UIViewController *)popViewControllerAnimated:(BOOL)animated { UIViewController *poppedCtrl = [super popViewControllerAnimated:NO]; [((customViewController *) self.topViewController) doCustomAnimation]; return poppedCtrl; } 不幸的是, UINavigationBar似乎忽略了我明确禁用内置的animation,它仍然是animation。 我还需要做些什么来防止导航栏的animation呢?

iOS 7 UINavigationBar有隐藏的后退button

我有一个应用程序,它的UINavigationBars中有一个自定义图像的后退button。 在iOS 6中,一切都很好,但在iOS 7中,button在大多数情况下是“隐形”的。 当我将一个新的视图控制器推入UINavigationController时,后面的button不会出现在新的屏幕上,但是如果我触摸button的位置,它会淡入。 如果我在导航控制器上设置了两个没有animation的视图控制器,那么button显示正常,但不会出现以后的推送。 我敢肯定,在我的代码中没有什么是故意隐藏后退button,并改变UINavigationBar上提供的各种颜色没有任何区别。

将UI导航栏设置为在Swift xCode中部分半透明

我想使我的导航栏有一个颜色的色调,但不能完全半透明。 这里是我有的代码和他们的结果: UINavigationBar.appearance().setBackgroundImage(UIImage(), forBarMetrics: UIBarMetrics.Default) UINavigationBar.appearance().shadowImage = UIImage() UINavigationBar.appearance().translucent = true UINavigationBar.appearance().barTintColor = UIColor(red: 0, green: 107/255, blue: 178/255, alpha: 0.5) 但是,如果我把“半透明”变成假,即使用这个代码: UINavigationBar.appearance().setBackgroundImage(UIImage(), forBarMetrics: UIBarMetrics.Default) UINavigationBar.appearance().shadowImage = UIImage() UINavigationBar.appearance().translucent = false UINavigationBar.appearance().barTintColor = UIColor(red: 0, green: 107/255, blue: 178/255, alpha: 0.5) 我得到这个结果: 如何让酒吧的alpha值为0.5或“部分半透明”? 谢谢,任何帮助将不胜感激。

iOS:Monotouch绑定外观的酒吧风格缺less?

我试图将其转换为Monotouch C#: [[UINavigationBar appearance] setBarStyle:UIBarStyleBlackOpaque]; 但是在Appearance对象上,似乎没有Bar风格。 有没有解决办法或替代接入点?

摆脱UINavigationBar右侧的空间

所以,这是我想要完成的: 这是一个带有UIBarButtonItem的UINavigationBar ,它使用自定义的UIButton进行初始化。 基本上是这样的: UIButton *favoriteButton = [UIButton buttonWithType:UIButtonTypeCustom]; [favoriteButton addTarget:target action:action forControlEvents:UIControlEventTouchUpInside]; favoriteButton.frame = CGRectMake(0.0f, 0.0f, 44.0f, 44.0f); UIImage *backgroundImage = [[UIImage imageNamed:@"favorite-button-background-orange"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 2, 0, 0)]; [favoriteButton setBackgroundImage:backgroundImage forState:UIControlStateNormal]; UIBarButtonItem *favoriteButtonItem = [[UIBarButtonItem alloc] initWithCustomView:favoriteButton]; 问题是我似乎无法摆脱UINavigationBar右侧的那个讨厌的小边框。 我试图设置一个自定义TitleView ,如“ 如何删除UIBarButtonItem旁边的填充 ”中所述,但这并没有改变一件事情。 我也尝试添加另一个UIBarButtonItem与消极的宽度(正如我读的一些博客文章中所build议的),但是也没有帮助。 UIBarButtonItem *negativeSpacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil]; negativeSpacer.width = -5.0f; self.navigationItem.rightBarButtonItems […]

在导航栏下添加进度条

我是iOS开发新手。 我想知道是否在iOS 7中发送邮件时, UINavigationBar ,其标题为:发送,有一个进度条正在加载,直到消息成功发送。 我的问题是: 这个酒吧是一个进度条吗? 在iOS 6中,进度条在UINavigationBar ? 有人可以给我一些关于如何在iOS 7和iOS6上创build的想法吗? 我还没有尝试过任何东西。 我想阅读一些教程或这类问题的例子。 这是我的代码: int progress = 50; CGRect navframe = [[self.navigationController navigationBar] frame]; int height= navframe.size.height; sendView = [[UIView alloc] init]; sendView.frame = CGRectMake(0, 0, 200, 30); sendView.backgroundColor = [UIColor clearColor]; UILabel* lbl = [[UILabel alloc] init]; lbl.frame = CGRectMake(0,0, 200, 15); lbl.backgroundColor […]

iOS UINavigationBar色彩颜色比颜色集显得更暗

我正在为特定的导航控制器设置自定义外观: //Set Cutom Nav Bar Appearance [[UINavigationBar appearanceWhenContainedIn:[MyNavigationControllerClass class], nil] setBackgroundImage: nil forBarMetrics: UIBarMetricsDefault]; [[UINavigationBar appearanceWhenContainedIn:[MyNavigationControllerClass class], nil] setBarTintColor: self.tableView.backgroundColor]; 当显示导航控制器时,预期的颜色是RGB(247,247,247) – 我已经仔细检查过的也是当设置该值时tableView.background颜色的值 – 但它在屏幕上显示为RGB(227 ,227,227)。 UINavigationBar外观代理的不同属性可以改变屏幕上显示的颜色吗? 谢谢! 编辑: 此外,如果我直接使用所需的颜色设置barTintColor,屏幕上显示的barTintColor仍比预期的要暗: UIColor* navBarBackgroundColor = [UIColor colorWithRed: (247.0 / 255.0) green: (247.0 / 255.0) blue: (247.0 / 255.0) alpha: 1]; //Set Cutom Nav Bar Appearance [[UINavigationBar appearanceWhenContainedIn:[MyNavigationControllerClass […]