1,148 questions
0
votes
0
answers
117
views
iOS 11+ Navigation Bar's buttons and title not changing on pushed view controller?
I have 2 view controllers. View Controller A** and View Controller B
I want to achieve a very simple thing. Setting left and right navigation bar buttons on View Controller A and change title and ...
0
votes
1
answer
816
views
iOS Navigation bar title truncated after updating it once
Fixed by changing the title update line to:
self.title = ""
self.title = "\(currentQuestion+1)/\(gameObject!.results.count)"
After messing around with constraints to find a good look on every iPhone ...
0
votes
1
answer
46
views
Navigation item don't appear when I running the Simulator, although navigation bar appears on screen
I added 2 bar button items on my main view controller and linked them into code. I also created outlet to navigation item. Although, when I run the iOS simulator none of my bar button items appear, ...
2
votes
1
answer
642
views
How to add shadow and remove bottom line in NavigationBar globally?
So I'm looking for how can I add shadow to NavigationBar and remove the bottom black line from NavigationBar? Also if I have searchBar in NavigationBar then shadow should go below to search bar. I ...
0
votes
1
answer
417
views
How do I display a UISearchController on a UINavigationItem without an underlying UIScrollView?
Maybe this is impossible, but I always assumed you could just throw a UISearchController instance onto any old view controller's navigationItem and get a search bar. It seems to me like no matter what ...
0
votes
2
answers
147
views
Setting title of UINavigationbar not working
I've looked through a few online tutorials, but nothing is working.
That's the code of my viewController:
import UIKit
class ViewController: UINavigationController {
let textView = UITextView()...
0
votes
2
answers
3k
views
Automatically add "back" button in navigation bar
First of all: I'm using Swift 5 with Xcode 10 (iOS 12.0).
I'm pretty new to Swift/iOS development and watched a couple of videos on how to add a "back" button to the navigation bar. In all of them (...
2
votes
3
answers
1k
views
Unable to add UISearchController's search bar into navigationbar and delegate methods not getting called
I want to achieve something very simple: a search bar in the navigation bar, with a Cancel button that shows when the bar is activated.
I am using a UISearchController, and currently I have the ...
0
votes
0
answers
124
views
Adding a prompt to UISearchBar breaks layout
I'm using an integrated UISearchBar with UINavigationItem:
navigationItem.searchController = searchController
navigationItem.hidesSearchBarWhenScrolling = false
It looks like this:
...
-1
votes
2
answers
152
views
iOS UINavigationBar button image is too small for pdf vector icon
I was set pdf vector image in UINavigationBar rightBarButtonItem but it still displaying too small.
How to display full size vector image in UINavigationBar?
I was try following code:-
First way:-
...
0
votes
0
answers
23
views
UINavigationbar masks item on return
I have a navigation bar button item with a shadow. When my controller appears the first time, the shadow shows fine:
When I navigate somewhere and return back, the navigation bar cuts the shadow:
0
votes
1
answer
144
views
How to install image for UIBarButtonItem of standard size?
When I try to add my image to a UIBarButtonItem, it changes its size. Setting the width for the UIBarButtonItem does not help fix the situation.
I would like to add one large image that would suit any ...
0
votes
1
answer
36
views
Unable to set back button on UINavigationController
I'm presenting my view controller with the following code:
UINavigationController* navigation = [[UINavigationController alloc] initWithRootViewController:sessionController];
[self ...
1
vote
3
answers
3k
views
How to set custom title view to center of navigation bar
I am trying to add custom view (Label) as title view of navigation item.
but it is not appearing in centre
func setupNavigationMultilineTitle(title:String) {
let autoscrollLabel = ...
0
votes
1
answer
409
views
How to make navigationItem.searchController's searchBar use the full width of the screen
On iOS 11 and 12, I can't figure out a way to make the searchBar use the whole width of the screen.
navigationItem.searchController = searchController
I can add more margin using:
let sb = ...
0
votes
1
answer
194
views
UIBarButtonItems Spacing Issue in iOS 11
I'm trying to adjust spacing between UIBar Button items.
func addLeftBarButtonItems() {
let btn1 = UIButton(type: UIButton.ButtonType.custom) as UIButton
let list_icon = UIImage(named: "list")...
0
votes
0
answers
53
views
Remove back button when using custom uinavigationbar with uinavigationcontroller
I'm having trouble finding a way to remove a 'ghost' back button (nothing but a blue back arrow) when I initialize my uinavigationcontroller with a custom uinavigationbar. When I click that back ...
1
vote
1
answer
1k
views
navigationItem button not showing
I have a UINavigationItem i am trying to show a UIBarButtonItem.
Now the problem is i added them correctly, they're functional and working 100%.
but they're not showing on the UINavigationBar.
...
0
votes
0
answers
185
views
UINavigationBar leftBarButtonItem position
I have an iOS project with UINavigationController.
When I pushviewcontroller with
animated = YES
[self.navigationController pushViewController:viewController animated:YES];
the top ...
3
votes
3
answers
3k
views
Custom BarButtonItem Item: Add red dot on top right corner, Swift 4 IOS
I want to add/set unread flag as red dot top right corner on UIbarButtonItem, See attached image for this
What should i do to add/set red dot on Bar Button item?
Once user tap on item then i want to ...
0
votes
0
answers
270
views
User editable large title in UINavigationBar
I need to allow the users to edit the large title of a navigation bar after they tap it.
The solution I have so far is to instantiate a UITextField and assign it as the titleView property of the nav ...
1
vote
2
answers
192
views
Slide UIBarButtonItem from the left
When going to a secondary page, I'm trying to slide the back button in from the left over a period of 0.33 seconds. Right now the animation doesn't appear to be doing that, even after slowing duration ...
0
votes
1
answer
37
views
How to be able to respond to a tap on a navigation item title?
I want to add a something like a UITapGesture when you tap at the title it goes to another controller. I think UITapGesture only works for UIView but I want it to be for a text(String).
@objc func ...
0
votes
1
answer
314
views
iOS CustomView With AutoLayout in navigationItem not receiving clicks
I created a custom view for navigationItem but somehow it is not receiving any click events:
The code for customView is below
class CustomNavigationView: UIView {
let backButton: UIButton = {
...
1
vote
1
answer
348
views
Swift / iOS - Preserve UINavigationItem when pushing new view controller
Is there a clean way in swift 4 to preserve the exact same UINavigationItems in the navigation bar that is presented when pushing from one UIViewController to the other.
This means I want the ...
0
votes
1
answer
59
views
Why does popping UIViewController change navigationItem's titleTextAttributes?
I'm building a social network that allows users to navigate from one profile to the next, by viewing who they follow. For simplicity, I created a test project with two view controllers: ViewController ...
-1
votes
1
answer
1k
views
Modify default navigation bar or create fully custom navigation bar from UIView
I worked on app, and I cannot choose what to do: 1) Modify default UINavigationBar or 2) Create my own view as navigation bar and use it 3) Or even more - just place need elements (buttons, imageViews ...
0
votes
1
answer
6k
views
How to show a custom view on top of navigation bar in Swift?
So the way I understand navigation bar (navigation item) is that it has three locations you can modify, which is left (leftBarButtomItem), middle (titleView), and right (rightBarButtonItem).
Now what ...
1
vote
1
answer
555
views
How do I get the back bar button item to show up in my navigation item in iOS?
I am not able to show a back bar button item in my navigation item in my root view controller of my navigation controller.
I have tried setting different properties.
Other questions like this do not ...
1
vote
0
answers
712
views
UINav Bars and Search Bars in iOS 12
I have an old ObjC iOS 9.3 App I am updating to iOS 12 and the iPhone X series.
The main view is a UIViewController with an embedded UITableView using STCollapseTableView. The table has a ...
1
vote
1
answer
372
views
Xcode 10 NavigationBar icons not appearing on some devices
I am using Xcode 10 today, during development and testing I noticed that icons did not appear in iPhone 5s, iPhone 6s, iPhone 7s, just work on iPhone X, I set this icons by using xCode storyboard, I ...
1
vote
0
answers
121
views
How to immediately apply tintColor to iOS navigation back button text
I'm working on an iOS application that allows a user to change the primary accent color. When the user selects the accent color, all currently displayed elements that contain the accent color need to ...
2
votes
1
answer
967
views
Swift - Large to Small Title Transition
I'm currently implementing a very simple TableViewController that has a navigation bar.
I have set the title, turned the navigation bar translucent = true , and turned PrefersLargeTitles = true
...
7
votes
0
answers
236
views
UINavigationBar not loading correctly
I know there are a lot of questions out there on this topic; however, none of those answers have helped me and I have tried so many ways of going about solving this. My problem is that my bar button ...
0
votes
1
answer
67
views
Set a default back button on a ViewController
short: I don´t understand how to programmatically add the default back button.
long: I have been asked to write an iOS app, without any previous experience I decided
to follow the advices and code ...
0
votes
0
answers
57
views
How to add a custom uiview to uibackbuttonitem?
I am trying to add a UILabel as a custom view to the backButtonItem of the navigationItem but it doesn’t show up.
I want to achieve something like the Mail iOS App as in the following picture where ...
1
vote
1
answer
2k
views
UIBarButtonItem not Showing
So Im trying to create a UIBarButtonItem with a custom UIView by subclassing it like so.
import UIKit
import SnapKit
class LocationManager: UIBarButtonItem {
let createdView = UIView()
lazy ...
5
votes
2
answers
1k
views
Top Safe Area Constraint Animation
Setup
A simple view controller with a UISearchController set in the navigation item to use iOS 11's search functionality in the search bar.
Any view with it's top constrained to the SafeArea.Top
...
2
votes
1
answer
84
views
Navigation tile text color not changing
I have three controller. let's say Controller A, B and C in sequence.
navigation title color in controller A is red.
blue in controller B and green in controller C.
When i push these viewcontroller ...
0
votes
1
answer
385
views
Changing NavigationItem title
I'm trying to change the title in Product but somehow the navigationItem is different. How come the navigationItem in Container is different compared to the one in Product?
class VC1: ...
1
vote
1
answer
1k
views
UIButton and Labels in Navigation Bar Title View in Storyboard
I have added a couple labels and an image to my navigation title bar. That all works great. But I want to cover all of it with a UIButton, but I can't get the UIButton to register any taps.
Here's ...
1
vote
1
answer
583
views
UIBarButtonItem size displays wrong
I have custom UINavigationBar(for JSQMessagesViewController) with some items. But I have some problems with leftBarButtonItem
func setNavigationBar() {
let screenSize: CGRect = UIScreen.main....
0
votes
1
answer
2k
views
UISearchBar in UINavigationController
I am wondering to programmatically put a UISearchBar into UINavigationController, rather than replacing UINavBar title, as I want the large title to show up. See Files app on iOS.
Here is my .swift
...
0
votes
1
answer
477
views
SearchResultsController appearing over UINavigationBar
I'd like to have a separate viewController as the searchResultsController however, I am getting unusual behaviour illustrated below.
I am setting up searchController as such;
func ...
-1
votes
1
answer
58
views
Custom button as leftBarButtonItem
I'm using this code to display a custom button as leftButtonItem:
let button = UIButton(type: .system)
button.setTitleColor(.white, for: .normal)
button.setImage(UIImage(named: "Back"), ...
1
vote
2
answers
445
views
navigationItem.setLeftBarButton() not working on old versions
I am using pushViewController like the following code:
let vc = A()
self.navigationController?.pushViewController(vc, animated:true)
I want to add a navigationItem to the page that opens. This ...
2
votes
0
answers
191
views
Custom view in navigationItem titleView is jumping when view controller is pushed iOS10 only
I'm trying to set a custom UILabel my navigationItem's titleView. In viewDidLoad I have the following code:
override func viewDidLoad() {
super.viewDidLoad()
let subtopicLabel = UILabel()
...
1
vote
2
answers
722
views
backBarButtonItem display image incorrect
I'm using custom UIBarButtonItem with image for backBarButtonItem. I discovered strange behavior, because in addition to my image, the default Arrow icon is also displayed.
class ViewController: ...
1
vote
3
answers
107
views
First leftBarButtonItem is hiding
I used 2 bar button items. One is for back button and second is for the title. It is working fine. But when the title string is large, the title shifts to left and back button does not appear, but it ...
2
votes
1
answer
67
views
iOS - BarButtonItem Corner spacing in UINavigatioItem
I am creating RightBarButtonItem in UINavigationItem, Programmatically.
Using this simple code
UIButton *backButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
[backButton setImage:[...