我不是使用Interface Builder的忠实粉丝,因此我不熟悉它.
我试图将UIToolbar添加到导航控制器,但因为Apple文档总是很清楚,我没有线索.
我正在转换旧项目以使用Storyboard.
这就是我所做的.
之后,界面构建器上的导航控制器底部出现一个白色矩形.我认为这是一个UIToolBar或占位符.我试图将BarButtonItem拖到这个"空间"并允许Xcode,显示如下:

当我运行应用程序时,工具栏显示为底部的白色矩形,而不是按钮.
按钮在层次结构上显示如下:

我想按钮应该在工具栏项目内,但Xcode禁止在那里拖动项目.
如何让按钮显示?
cocoa-touch uitoolbar uinavigationcontroller ios uistoryboard
我有一个UITextView内部UIViewController使用自动布局将其固定为0(因此它填满整个屏幕).我也推动使用这个视图UINavigationController.
我遇到了一个奇怪的错误,如果UITextView有足够的文本使它在屏幕上运行,那么内容将被设置在UINavigationBar.如果没有足够的文本来填充屏幕,则文本的布局不会在UINavigationBar.
这是正在发生的事情,这是当有足够的文本它离开屏幕,你需要滚动查看所有这些.

我试过了:
设置内容的插入UITextView.
确保UINavigationBar它不是半透明的.
尝试设置这个 self.automaticallyAdjustsScrollViewInsets = NO;
objective-c uitextview uinavigationcontroller ios autolayout
我想找出一种方法,这样,如果用户按下"取消"按钮(我认为不能删除)ABPeoplePickerNavigationController,视图控制器要么不关闭,要么自动重新打开.
例如,给出以下内容:
var picker = ABPeoplePickerNavigationController()
picker.peoplePickerDelegate = self
self.presentViewController(picker, animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)
我希望能够做到这样的事情:
if (self.presentedViewController != picker && !userContinuedPastPicker) {
//where userContinuedPastPicker is a boolean set to false
//in a delegate method called when the user clicks on an a contact
//(meaning the user didn't press the cancel button but instead clicked on a contact)
//create and present a UIAlertAction informing the user they must select a contact
//present picker again
self.presentViewController(picker, animated: true, completion: nil) …Run Code Online (Sandbox Code Playgroud) uinavigationcontroller abaddressbook ios presentviewcontroller swift
正如标题所示,我在使用UINavigationControllers作为UISplitView中的Master和Detail视图时遇到了问题.导航控制器为底栏留出空间.当我删除导航控制器时,视图渲染得很好.
故事板看起来像:
TabBarController - > SplitView - > UINavigationController(主和详细信息) - >每个ViewControllers.
我可以通过添加40px的额外空间作为约束来"破解"视图以正确渲染,但我宁愿不这样做.
我错过了什么?
编辑:我在一个空项目中嘲笑了一切,默认情况下似乎工作正常.看来我在主项目中改变了一些设置或做了一些导致这个问题的事情.
cocoa-touch storyboard uinavigationcontroller uisplitviewcontroller ios
我有一个项目,我需要在一个视图中使用自定义tabbar,navigationcontroller和pageviewcontroller.我已经成功创建了这个,但是我遇到了一个我无法解决的错误:
我的pageviewcontroller中的第一个viewcontroller没有正确设置其视图高度(或者更确切地说是它的Y值).滚动时刻会将其设置为正确的高度.
我在这里创建了一个最小的测试项目.
编辑:我尝试过设置collectionView.contentInset和automaticallyAdjustsScrollViewInsets所有可能的组合,但无济于事.任何人?
uiscrollview uinavigationcontroller ios uipageviewcontroller
当我从主屏幕使用3D Touch Shortcuts时,我试图转向不同的视图控制器.
应用程序嵌入在一个UITabBarController并且每个选项卡根控制器是一个UINavigationController.
以下是我尝试处理快捷方式以加载每个快捷方式的视图控制器的方法.
private func handleShortcutItem(shortcutItem: UIApplicationShortcutItem) {
if let rootViewController = window?.rootViewController, let shortcutItemType = ShortcutItemType(shortcutItem: shortcutItem) {
let sb = UIStoryboard(name: "main", bundle: nil)
let helloVC = sb.instantiateViewControllerWithIdentifier("HelloVC") as! HelloViewController
let goodbyeVC = sb.instantiateViewControllerWithIdentifier("GoodbyeVC") as! GoodbyeViewController
switch shortcutItemType {
case .Hello:
rootViewController.presentViewController(helloVC, animated: true, completion: nil)
break
case .Goodbye:
rootViewController.presentViewController(goodbyeVC, animated: true, completion: nil)
break
}
}
}
Run Code Online (Sandbox Code Playgroud)
与此代码的快捷方式只打开应用程序初始视图控制器和不将helloVC和goodbyeVC其在不同的选项卡控制器.
我认为这是因为ViewControllers我试图加载嵌入在嵌入的内部UINavigationController以及嵌入内部UITabBarController.
我怎么能presentViewController …
uitabbarcontroller uinavigationcontroller ios presentviewcontroller swift
读过的所有人,您好,谢谢。我正在使用Xcode 8.2.1和Swift 3.0为iOS设备编写Viber或WhatsApp之类的应用程序。我有一个问题:我希望我的应用程序有一个导航控制器,但不是一个简单的控制器,我希望它是自定义的。WhatsApp有一个印刷屏幕需要理解,我正在尝试实现以下目标:
如我们所见,该导航控制器具有3个按钮,即标签和带有头像的图像。我也想将颜色更改为绿色。由于这个原因,我创建了类:
import UIKit
class CustomNavigationController: UINavigationController {
override func viewDidLoad() {
super.viewDidLoad()
self.navigationBar.barTintColor = UIColor.green
let imageView = UIImageView(frame: CGRect(x: 0, y: 0, width: 39, height: 39))
imageView.contentMode = .scaleAspectFit
let image = UIImage(named: "logo")
imageView.image = image
navigationItem.titleView = imageView
}
}
Run Code Online (Sandbox Code Playgroud)
let imageView = UIImageView(frame: CGRect(x: 0, y: 0, width: 39, height: 39))
imageView.contentMode = .scaleAspectFit
let image = UIImage(named: "logo")
imageView.image = image
navigationItem.titleView = imageView
Run Code Online (Sandbox Code Playgroud)
到ViewController,将显示带有徽标的图像,但是我需要完整的类,该类将在某个地方连接(例如,在Interface Builder中),它将使按钮,图像等构成一个漂亮的导航控制器。此外,我可以使用另一个导航控制器,并将其连接到不同的屏幕,例如,在上面不需要图像,仅需要按钮。所以问题是:如何制作自定义的Navigation Controller类?
感谢您的帮助,我将非常高兴和感谢。
uinavigationbar uinavigationcontroller uinavigationitem ios swift3
我的主视图控制器是 Tabbarcontroller
所以,我想首先关闭呈现的视图控制器,然后我想弹出我以前推送的控制器
这是我的导航流程
From Tabbarviewcontroller
1- let aVC = self.storyboard?.instantiateViewController(withIdentifier: "a") as! OrderListingViewController
self.navigationController?.pushViewController(aVC, animated: true)
From A viewcontroller
2- let bVC = self.storyboard?.instantiateViewController(withIdentifier: "b") as! OrderListingViewController
self.navigationController?.pushViewController(bVC, animated: true)
From B viewcontroller
let cVC = self.storyboard?.instantiateViewController(withIdentifier: "c") as! RejectOrderViewController
cVC.providesPresentationContextTransitionStyle = true
cVC.definesPresentationContext = true
cVC.modalPresentationStyle=UIModalPresentationStyle.overCurrentContext
self.tabBarController?.presentVC(cVC)
Run Code Online (Sandbox Code Playgroud)
所以从 C Viewcontroller 当我解散我想显示 Tabbarviewcontroller 或 …
希望在导航栏的后退按钮项上拥有自己的自定义字体,这过去对我有用:
let barButtonAttributes = [NSAttributedString.Key.foregroundColor : UIColor.pink,
NSAttributedString.Key.font : UIFont(name: "My-Awesome-Font", size: 18)!]
UIBarButtonItem.appearance().setTitleTextAttributes(barButtonAttributes, for: .normal)
UIBarButtonItem.appearance().setTitleTextAttributes(barButtonAttributes, for: .highlighted)
Run Code Online (Sandbox Code Playgroud)
在iOS 13上,这对我来说已停止工作。有没有解决的办法?
uinavigationbar uinavigationcontroller uibarbuttonitem ios swift
ios ×10
swift ×3
cocoa-touch ×2
swift3 ×2
autolayout ×1
iphone ×1
navigation ×1
objective-c ×1
storyboard ×1
uiscrollview ×1
uistoryboard ×1
uitextview ×1
uitoolbar ×1