Tag: uinavigationbar

iOS 7上的背面箭头

我需要在我的应用程序中添加一个左边栏button项,看起来像系统后退button,但不是系统后退button,因为它会出现在视图控制器,这是我的navController的堆栈的唯一VC,并执行我自己的代码。 简单地写“返回”对我来说并不好,因为我需要显示“<”箭头。 有没有办法以编程方式创build一个这样的箭头,没有使用该箭头形象?

呈现模态视图控制器隐藏导航栏

我有一个导航栏的应用程序导航,但有一些实例,而不是将视图控制器推到堆栈上,我需要以模态方式呈现视图控制器。 问题是,当我closures模式视图控制器时,除了导航栏被隐藏和(父视图)已被resize,这是根据文档预期的行为,一切都按预期运行。 所以我想我可以简单地调用一个内置的方法来取消隐藏导航栏。 我已经尝试过了 [self.navigationController setNavigationBarHidden:NO]; 以及没有成功的animation版本。 文档在方法中谈到这个 presentModalViewController: animated: 在它所说的讨论部分, 在iPhone和iPod touch设备上,modalViewController的视图始终呈现为全屏“and”将modalViewController属性设置为指定的视图控制器。 调整其视图并将其附加到视图层次结构中。“然而,文档并没有告诉我如何在驳回模式视图之后撤销这个过程。 有没有其他人经历过这个,find了解决办法? 编辑:我有这个相同的问题,所以不要问我自己的问题,我赞助这一个奖金。 这是我的具体情况: 在我的情况下,我通过导航控制器在模态视图控制器中显示图像select器: -(void) chooseImage { if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) { imagepicker = [[UIImagePickerController alloc] init]; imagepicker.allowsEditing = NO; imagepicker.delegate = self; imagepicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; imagepicker.navigationBar.opaque = true; imagepicker.wantsFullScreenLayout = NO; if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { if (self.view.window != nil) { […]

在运行时创buildpopup视图锚的button

这可能是不可能的,但我希望有人会有一个想法如何做到这一点。 我有一个应用程序,我只从iPhone移植到环球。 在iPhone上,我正在使用选项卡式应用程序。 我使用三个标签来显示正常的数据。 我有一个只有在满足特定条件时才会显示的第四个选项卡。 要添加标签,我这样做: if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { UITabBarController *tabController = (UITabBarController *) self.rootViewController; NSMutableArray* newArray = [NSMutableArray arrayWithArray: tabController.viewControllers]; [newArray addObject: [theStoryboard instantiateViewControllerWithIdentifier: @"AdditionalView-Phone"]]; [tabController setViewControllers:newArray animated:YES]; } 对于iPad,我在初始视图上有足够的空间来显示iPhone UI中主要三个选项卡的所有内容。 所以我需要的是一个额外的(小)视图的“额外”的数据。 我想用popOver视图来完成,所以我使用Utility App模板中的导航栏和popupbutton来设置初始视图。 但现在我卡住了。 我无法弄清楚如何在运行时创buildpopoverbutton,并使其正确执行popOver视图。 我可以像这样添加button: UIBarButtonItem *flipButton = [[UIBarButtonItem alloc] initWithTitle: @"Modem" style: UIBarButtonItemStylePlain target: self action: @selector(togglePopover:)]; […]

如何在iOS中像Android一样实现菜单

我需要像android.menu意味着在导航栏上的button(右侧) iOS的菜单。 如果我点击那个菜单就会显示。 我正在使用故事板。

如何在iOS 11中正确设置UINavigationBar高度

在我的iOS 9+应用程序中,我使用UINavigationBar在一些UIViewController “手动”(=直接将它们放在VC中,而不是使用UINavigationViewController )。 使用简单的UINavigationBar为这样的UINavigationBar设置高度是没有问题的。 然而,在iOS 11中,条本身仍然正确地使用分配的大小,但是内容不再正确定位(现在被分配到顶部)。 任何想法如何解决这个问题? 编辑: 我很确定,这不是“ 自定义iOS 11导航栏高度自定义 ”的重复,这个问题解决了UINavigationBar子类的问题,而我直接使用UINavigationBar 。 另外,所描述的问题似乎从Beta 4开始就解决了,而我在Beta 6中遇到了这个问题。 编辑2: 同时,我在另一个线程中实现了CharlieSu提出的UINavigationBar子类。 但是这并没有解决我的问题。 看来,子视图框架都设置正确(没有手动这样做),但布局是打破了反正。 所以手动设置帧没有任何区别。

如何在UINavigationBar中添加UISegmentedControl?

我试图将UISegmentedControl添加到带有标题的UINavigationBar的底部。 但我不能添加它,我不能添加UISegmentedControl在tableView.headerView ,因为我需要在tableView.headerViewsearch栏,所以只有一个解决scheme,我需要将UISegmentedControl添加到UINavigationBar的底部。 任何人有另一个想法,我可以解决这种情况? 这里是我试过的代码(用Swift ): class searchingViewController: UITableViewController{ override func viewDidLoad() { var items: [AnyObject] = ["Searching Method A", "Searching Method B"] var searchSC:UISegmentedControl! searchSC.frame = CGRectMake(0, 0, frame.width – 20, 30) searchSC.selectedSegmentIndex = 1 searchSC.backgroundColor = UIColor(white: 1, alpha: 1) searchSC.layer.cornerRadius = 5.0 navigateUIToolBar = UIToolbar(frame: CGRectMake(frame.minX + 10, ios7_8Info.getStatusBarHeight()+self.navigationController!.navigationBar.frame.height+frame.minY+(21/2), frame.width – 20, […]

将图像添加到导航项的标题

我想在我的导航栏上的标题左侧添加一个徽标。 标题属性似乎只采取了一个NSString。 将图像添加到导航栏的最佳方法是什么?

如何在使用自定义字体时垂直更正navigationBar的titleView文本位置?

我们在导航栏中使用titleView的自定义字体。 不知何故,苹果总是把这种字体画得太高。 在导航栏中使用自定义字体时,如何纠正这个奇怪的偏移量?

带有副标题的UINavigationBar TitleView

我想在我的UINavigationBar中有一个titleView,它有两行文本,而不是只有一行 当我有一个“返回”button和一个“编辑”button,因为它看起来接近居中,我目前的实施工作得很好。 问题是当我只有一个button。 它看起来很奇怪和错误,因为视图集中在可用空间上。 带有左右button的UINavigationBar UINavigationBar只有一个button 这是我目前的实现: CGRect frame = self.navigationController.navigationBar.frame; UIView *twoLineTitleView = [[UIView alloc] initWithFrame:CGRectMake(CGRectGetWidth(frame), 0, CGRectGetWidth(frame), CGRectGetHeight(frame))]; UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 8, CGRectGetWidth(frame), 14)]; titleLabel.backgroundColor = [UIColor clearColor]; titleLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth; titleLabel.textAlignment = UITextAlignmentCenter; titleLabel.text = self.title; [twoLineTitleView addSubview:titleLabel]; UILabel *subTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 23, CGRectGetWidth(frame), 14)]; subTitleLabel.backgroundColor = […]

iOS 7的UINavigationBar外观不工作的第一次…

我正在尝试更改iOS7应用程序中UINavigationBar的外观。 我正在做以下事情: – (void)viewDidLoad { [super viewDidLoad]; m_sNumberToCall = @""; UIBarButtonItem * btn = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"IconHome.png"] style:UIBarButtonItemStyleBordered target:self action:@selector(btHomeTouched:)]; self.navigationItem.leftBarButtonItem = btn; self.navigationController.navigationBar.translucent = YES; [[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"TVCNavBack.png"] forBarMetrics:UIBarMetricsDefault]; NSShadow * shadow = [[NSShadow alloc] init]; shadow.shadowColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.8]; shadow.shadowOffset = CGSizeMake(0, 1); [[UINavigationBar appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys: […]