All Questions
56 questions
1
vote
3
answers
329
views
Changing appearance right after changing app language on fly causing problem in iOS using swift
I have both options Appearance and change Language (to Arabic) in my iOS app. When you change language and try to change appearance, some UI elements restores their direction i.e RTL to LTR
I'm doing ...
-1
votes
1
answer
58
views
How to Change Keyboard Return key type in UISearchBar
I would like to change the string title of the return key of a keyboard invoked by a searchBar in my iOS App. I want to change the title from "Search" to "Done".
My searchBar is ...
0
votes
2
answers
828
views
how to remove shawdow of navigation bar in ios?
I want to remove that line and shadow type bar in navigation bar
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: ...
-1
votes
1
answer
205
views
How to add gradient color to UIView using Custom Class and UIAppearnace() in swift
Hello Everyone I want to add Gradient Background Color to UIView using UIAppearnce() with CustomView Class.I am facing an error -
Thread 1: " Illegal axis type, @, for appearance setter, ...
5
votes
1
answer
2k
views
Setting a UITabBarAppearance breaks UITabBarItem appearance proxy font size when selecting tabs
The following, which sets the title text appearance proxy to use a big font, works as expected, and the UITabBarItems retain their big font when you select them:
func application(_ application: ...
0
votes
2
answers
61
views
Why does UIButton Label ingnores appearance setting when contained in UITableView tableHeaderView?
I have created a simple UIViewController which contains a UITableView. When adding a tableHeaderView which includes a UIButton it seems not to be possible to change the button label using appearance ...
-2
votes
2
answers
1k
views
UINavigationBar.appearance().isTranslucent not working
When I use this:
UINavigationBar.appearance().backgroundColor = UIColor(named: "brown")
I get a nav bar that has the correct brown and it is translucent.
But I don't want it to be ...
0
votes
1
answer
133
views
Remove/handle UINavigationBar UIAppearence to fix issue in UIActivityViewController share screen title transparent after tapping more in Swift iOS
I've applied UINavigationBar.appearence() with use of class UIAppearence() throught out the app. Due to this facing issue while showing UIActivityViewController() share doc, I want to remove ...
1
vote
0
answers
34
views
UIAppearance Protocol for MessagesExtension App
I'm working on an iOS Messages Extension app. In this app, I use google autocomplete. To style an autocomplete table, Google recommends using the UIAppearance protocol in the AppDelegate.m file for ...
1
vote
0
answers
357
views
Factual UIAppearance limitations for VC and swiftUI?
I was trying to go for a Theme object allowing me to well, manage the appearance of all my UI component toolbox.
Even though I understand that UIAppearance is what Apple wants you to use, I am ...
0
votes
1
answer
1k
views
iOS - Customize Navigation Bar for only some UIViewController
I have to add new screens to an existing app, that will use a different navigation bar style than the one that already exists and will be accessed from different screens. The idea would be to show the ...
0
votes
1
answer
2k
views
Detect UITableViewCells that appear on the screen
I need to make a request when the user saw the UITableViewCell, I used func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) but this method call ...
0
votes
2
answers
121
views
Is there a way to change UILabel line spacing throughout the whole app like using UIAppearance or something like that
I am trying to set the line spacing of all used UILabel in my app. I have found a solution to set line spacing using NSMutableParagraphStyle and attributedText but I am trying to find another solution ...
3
votes
3
answers
1k
views
UIBarButtonItem setBackButtonTitlePositionAdjustment doesn't work
Updated
I want to change offset between Arrow and Text in Back Button in Navigation Bar. It works just fine until I set
UINavigationBar.appearance().standardAppearance = newAppearance
Here is the ...
1
vote
3
answers
741
views
How to change UIButton titlelabel fonts style and size in appearance()?
I am using the code below but it's not working. Can anyone help me to resolve this problem?
UIButton.appearance().titleLabel?.font = UIFont(name: "Roboto-Regular", size: 20.0)
2
votes
0
answers
527
views
In iOS 13 - How can we implement more than two color modes / themes?
Looking at the brand new WWDC video Implementing Dark Mode on iOS we see that it can be handled quite easily. We can use the new dynamic system colors and they will have specific values depending on ...
1
vote
1
answer
61
views
UIAppearance edge insets
I have a UIView subclass which I use in my app (And is in a 3rd party library) for displaying toast notifications. I want to modify this slightly for another app I'm working on and so I'm adding ...
0
votes
0
answers
38
views
Is there a list of all the UIApperance traits for each control/view? [duplicate]
So if we want to make all UIButtons have a red background, we can use UIButton.appearance().backgroundColor = UIColor.red.
This is great and really convenient, but I'm wondering if there's a list of ...
1
vote
0
answers
169
views
UISearchController appearance troubles
I'm currently developing an app with a search functionally, for that I use an UISearchController. The searchBar of the UISearchController is display within the NavigationItem.
The problem is that ...
1
vote
1
answer
359
views
Globally apply a gradient to the navigation bar and handle orientation changes
I need to apply a gradient globally to my status and navigation bars and have it adjust properly to orientation changes. Because I want this to be global, I'm trying to use UIAppearance. Surprisingly, ...
0
votes
0
answers
81
views
UIAppearance doesn't work into the reusable collection view cell
I have faced with the problem of using the UIAppearance proxy in reusable collection view cells.
I apply an appearance (font) for the paricular label on the whole-project level, not for containers:
...
0
votes
0
answers
94
views
UINavigationBar.appearance().tintColor vs. UIBarButtonItem foregroundColor
I was using UIBarButtonItem appearance to set default font and colour.
UIBarButtonItem.appearance().setTitleTextAttributes([NSAttributedString.Key.foregroundColor: UIColor(red: 38/255, green: 110/...
1
vote
2
answers
869
views
Setting UITableViewCell selected background color with UIAppearence not working
I want to change the selected color of all my UITableViewCells. I am already using UIAppearence to define basic properties for some other UI elements and it works.
However, setting
let bgColorView = ...
0
votes
2
answers
96
views
Swift - UIAppearance Class
I have label in my Storyboard connected to my View Controller via an IBOutlet
I have extended UILabel as below
extension UILabel {
func winnerLabel() -> UILabel {
let winnerLabel = ...
0
votes
1
answer
474
views
Round button on custom class with UIAppearance
I am trying to apply styles on a custom class using UIAppearance()
class MainStyleButton: UIButton {}
with a code:
let buttonView = MainStyleButton.appearance()
buttonView.backgroundColor = Style....
4
votes
3
answers
3k
views
Change TintColor of UIImagePickerController
I've set a global tintColor in my app by calling:
UIView.appearance().tintColor = myColor
However, the same color applies to the UIImagePickerController and only some of the UI elements are colored:...
1
vote
0
answers
345
views
Swift theme change not working on UILabel within UITableViewCell
I am working on providing a light/dark theme option to the users in an iOS app. When I put the theme in app delegate, the app loads fine with the proper theme but when I toggle a switch in settings to ...
0
votes
1
answer
58
views
Setting UIAppearance is not effecting cocoapod UI component
I am currently working on an app, which uses an cocoapod UI component. All my efforts to change the appearance (custom font) of the contained labels failed so far.
Does anybody have experienced a ...
1
vote
1
answer
364
views
Change UIAppearance of default UILabels only
I'm building an app with a theme switcher and I'd like to use Appearance to switch the textColor of UILabels that have the default color (black -> white).
I assumed this would be possible and created ...
0
votes
0
answers
137
views
Reset Appearance for button font conditionally
My App supports two languages. Language can be changed within the app. For buttons I have set font through appearance property in app delegate. I need two different fonts based on language. I am ...
3
votes
1
answer
2k
views
iOS UILabel.appearance().textColor is not available
I am trying to change default text color for all labels in my app. I have tried to use UILabel.appearance().textColor, but it's not available for me. Can somebody advise what am I doing wrong? I have ...
9
votes
1
answer
601
views
Different appearances in different UINavigationControllers
In iOS 11 I'm currently changing the back button for my navigation controllers like this:
UINavigationBar.appearance().backIndicatorImage = whiteBackButtonImage!.withRenderingMode(.alwaysOriginal)
...
1
vote
2
answers
995
views
How to make UIAppearance proxies apply to programmatically created views?
I'm trying to use UIAppearance to create a theme for my app.
Say I want all my UILabel's texts to be orange. I wrote:
UILabel.appearance(whenContainedInInstancesOf: [UIView.self]).textColor = ....
0
votes
1
answer
358
views
Make UINavigationBar have a gradient background using UIAppearance
Following this question, I am able to make a background gradient for a UINavigationBar, however when I try to set it through UIAppearance, the app crashes in the didFinishLaunching because there is no ...
2
votes
3
answers
5k
views
How to set backgroundColor of a ViewController with UIAppearance
I'm trying to use UIAppearance to configure the style of my Apps. It works perfectly with the UI components like UIView or UIButton, but it doesn't with UIViewControllers. I would like to do something ...
17
votes
1
answer
11k
views
UIAppearance Swift 4
After updating to Swift 4, I am getting a compiler error:
Static member 'appearance' cannot be used on protocol metatype 'UIAppearance.Protocol'
Here is my viewWillAppear method in my custom Tab ...
1
vote
1
answer
88
views
What Swift property types are allowed in UIApperance compliant custom classes?
I recently tried with no success to add a UIApperance compliant property to one of my Swift classes (ScoreView). You can see the relevant code below:
private var gaugeThresholds = Array<...
-1
votes
2
answers
3k
views
How to auto layout an app for different devices.
Apologies in advance for the basic nature of this question. I'm happy to be redirected to a previously answered version of this question, but haven't found it yet.
I just finished up the majority of ...
1
vote
1
answer
1k
views
Set default appearance for a UIView subclass without overriding initialize() in Swift 3.1
I have a subclass of UITextView, which needs to have a specific default appearance. So far, I've been able to achieve this by overriding the initialize() class function, which has been deprecated in ...
2
votes
2
answers
1k
views
iOS: Override UIAppearance appearanceWhenContainedInInstancesOfClasses
I have a global theme applied that changes the background color of a UITableViewHeaderFooterView. Below is the code:
[[UIView appearanceWhenContainedInInstancesOfClasses:@[[...
5
votes
0
answers
2k
views
UIViewController appearance
Is it possible to set an appearance for a UIViewController subclass?
I would like to have variables like this one
dynamic open var doneButtonColor: UIColor?
within the UIViewController subclass, ...
2
votes
1
answer
1k
views
How to change tint of navigation bar in SafariViewController when setting UIButton appearance in AppDelegate
I am trying to change the tint of the navigation bar in a SFSafariViewController when UIButton.appearance() is being set in the AppDelegate.
For example:
AppDelegate
func application(_ application: ...
5
votes
1
answer
2k
views
UINavigationBar.appearance().translucent is creating a big white space
UPDATE 2:
I'm still hoping to get some help with this problem so I'm going to refine my question a little now that I've narrowed it down better.
My UIViewController hierarchy looks like this:
The ...
3
votes
1
answer
2k
views
Change UITabBar style with a switch
I'm trying to make a dark mode switch. I started with this tutorial (link), but I can't change the tabBar's style. The navBar's style changes, but the tabBar stays the same.
How can I change the ...
7
votes
2
answers
3k
views
Set text attributes via UIAppearance in a custom UIView subclass in Swift
Accoding to NSHipster, "having custom UI classes conform to UIAppearance is not only a best-practice, but it demonstrates a certain level of care being put into its implementation."
Therefore, I'm ...
3
votes
1
answer
471
views
UIAppearance and Rounded Borders in Swift
So I'm fairly new to the whole UIAppearance approach to doing things, and doing it with swift. Hurray for not a ton of documentation out there.
I'm trying to set my border radius through UIAppearance ...
1
vote
0
answers
378
views
Global dark mode settings for iOS?
I have a flag in my plist where I'd like to change the style from light to dark mode. For example, for the tabBar, there is a dark style and same for navigationBar.
How can I set this globally ...
1
vote
1
answer
701
views
UISearchBar.appearance() not working on first launch?
In my AppDelegate, I have customized my UISearchBars in my app (i have a few), so they would match the app colors and such. (The app color isa sort of teal). My code is as follows:
// Set appearance ...
3
votes
2
answers
3k
views
UIAppearance for UINavigationBar not working when used with custom view controller...?
I have a method which sets the appearance of UINavigationBar. FlightSearchViewController is subclassed from UIViewController but the nav bar is not updated as expected. If I write UIViewController in ...
8
votes
4
answers
32k
views
How to default UILabel Font and Size using Swift
I find UISegmentedControl change font and size like this :
UISegmentedControl.appearance().setTitleTextAttributes(myFontAttribute as [NSObject : AnyObject] , forState: .Normal)
but UILabel have no ...