Questions tagged [uikit]
UIKit (not to be confused with the front-end framework GetUIKit) is the object-oriented framework that is responsible for most of the iOS user interface.
11,954
questions
-2
votes
0
answers
19
views
Custom tab bar in swift [closed]
I would like to know how can I make the design of the tab bar as on the picture below
Appointment image
I want to make the same as on the picture like: upcoming, canceled and completed.
0
votes
0
answers
10
views
How to set accessibilityIdentifier for a title of a viewcontroller in UIKit [duplicate]
The problem is that I can't set accessibilityIdentifier for a title of a viewcontroller that is inside of a NavigationController. I need to set it for testing purposes for Appium.
The simplest ...
0
votes
0
answers
17
views
Why UIActivityViewController navigationBar backgroundColor is clear?
Under iOS 17, I need to set view.backgroundColor when using UIActivityViewController, otherwise the navigationBar will be transparent. (iOS 17 does not have this problem)
I have checked many tutorial ...
1
vote
1
answer
22
views
I am trying to set height for header and footer in section through code but it doesn't work
I tried to set height for footer and header for section in table view through code but it doesn't work . When I do it from storyboard , it works fine .
This is my code
import UIKit
class ...
0
votes
0
answers
27
views
How to transition a dragged UIView smoothly from one superview to another while maintaining the interaction in UIKit?
I have a UIView that is being dragged after a UILongPressGestureRecognizer has succesfully executed. I am using gesture.location(in: superview) from the UILongPressGestureRecognizer to drive the ...
0
votes
2
answers
36
views
UIScrollView doesn't bounce back to exact same position
I have a very annoying detail problem that I don't know how to solve properly with UIScrollView.
I have base UIViewController class with a scrollView and contentView set up like this:
import UIKit
/*
...
0
votes
0
answers
25
views
UIImage Replace Color with Background Image Washing Out and Overlaying everything Instead of Replacing
My app is trying to choose an image, and replace a given color with a separate image (green-screen). It uses Obj-C. So far, I'm attempting to replace a specific color (sky-blue) on this image with a ...
-1
votes
1
answer
20
views
ViewportSizing maximumViewportInset cannot be larger than frame
I create my WebView (WKWebView) programmatically and get this error in Xcode console when loading an HTML string. The WebView, at the moment of loading, is not a part of the view hierarchy.
[...
0
votes
2
answers
50
views
Delegate returning nil even though delegate has been set
new to stackoverflow so please let me know if extra context needs to be provided but I have an xcode project (fitness app) and in it I have a tab bar controller , two view controllers called ...
3
votes
1
answer
40
views
Is an empty subclass of UIAlertController safe for use with `appearance(whenContainedInInstancesOf:)`
Somebody here on SO wanted to alter the behavior of UIAlertAction buttons in a specific UIAlertController, but not others. (They wanted multi-line button labels for one alert but normal behavior for ...
-1
votes
0
answers
30
views
Task is being inserted successfully, but data not showing in Sqlite3 iOS
I have been trying to build this Checklist Task App in iOS using sqlite3. Xcode is telling me that it is unable to open the database file.
I am adding the code Snippet for further reference, please ...
0
votes
0
answers
25
views
UITableViewController tableview cells showing only while debug
Tableview cells are visible while app is in debug but when tried to terminate app and than try to reopen the app, cells are not visible.
Approach(Which i used in my app):
lazy var ...
0
votes
0
answers
28
views
Different CLGeocoder results between device and simulator. Why might this happen?
I am using the following code to get a Placemark (and coordinates) from a city name, both for mapping and current weather information.
When I run my application on a iPhone 15 Pro Max (in the ...
-1
votes
0
answers
39
views
Image upload in swift
I'm currently working on one project and I faced with one problem that I can not upload the image selected by the user to the server.
public func imagePickerController(_ picker: ...
0
votes
0
answers
45
views
Spotlighting / Highlighting a specific part of a UIView that is wrapped with a UIViewRepresentable?
For extra context, this is a follow up question to this. Would appreciate reading that post as theres quite a bunch of context as to my initial approach and what I need to ultimately accomplish.
I ...
0
votes
0
answers
19
views
UITextField textColor changed after clearing the text
The text color starts out as red and changes to blue after clearing the text.
@interface ViewController ()
@property (nonatomic, strong) UITextField *textField;
@end
@implementation ViewController
...
0
votes
1
answer
50
views
Displaying a UIKit View in a SwiftUI sheet
I am trying to show a UiKit view in a SwiftUI sheet, however when I open the sheet, it is completely empty, none of the UIKit elements show up. All I can see is the navigation view bar title. I have ...
1
vote
0
answers
49
views
How to Capture a View thats in front of user's eye in visionOS Programmatically
I'm working on a VisionOS-based application, and I'm facing a challenge when attempting to programmatically capture the content of a view that's currently in front of the user's eyes.
I've tried using ...
-1
votes
2
answers
38
views
How do I change a UIButton background color dynamically in UIKit when type is custom and corner style is capsule?
I am trying to change the background color of a custom button.
This is the button I have declared in my storyboard:
And this is the code I am using to set the background color:
myButton....
0
votes
0
answers
33
views
iOS PDFView selectAll and currentSelection doesn't select text visually
I'm trying to highlight a word (with Copy, Find, Translate buttons) by single tap in PDFView.
Like this:
enter image description here
It is easy to identify the word that was tapped thanks to the ...
1
vote
0
answers
26
views
Self sizing table view cell not resizing
I am trying to create a self sizing tableview cell with stack view, but the data get shrinked, is there any better way to achieve this.
For Stack view Distribution: Fill Proportionally
also I added ...
-1
votes
0
answers
31
views
Gradient color issue with button [duplicate]
I want to add gradient background to my button in swift. I have this function for adding the color:
func addGradientToView(_ view: UIView, firstColor: UIColor, secondColor: UIColor) {
let ...
0
votes
0
answers
19
views
N x M UICompositionalLayout with estimatedWidth for each cell
I'm trying to create this section of the UICollectionView from X when you try to configure your interests. All 3 rows scroll as a together as a group. Here a picture:
Each item has an estimatedWidth ...
0
votes
1
answer
38
views
How to use specific symbol of SVG in iOS swift?
I've download google SVG file and droped to xcode and I can see
The name of the reasource is search and I used in UIButton as button.setImage(UIImage(named: "search")!, for: .normal) which ...
1
vote
1
answer
48
views
UILabel in self-sizing UITableView Cell calculate height randomly
I have an issue with the self-sizing cell in UITableView in Swift, iOS 15.
I want to create a cell like here:
And it works fine when the view renders 80% of the cells.
But sometimes I have something ...
0
votes
2
answers
56
views
How to change the tint of a JournalingSuggestionsPicker
As it says. It defaults to system blue, but I found no way to modify it.
The accentColor or tint won't work on the JournalingSuggestions sheet.
JournalingSuggestionsPicker {
Text("H&...
-1
votes
0
answers
42
views
How to prevent UILabel from clipping text?
Our font has some characters extending beyond its line, especially in an Arabic locale. UILabel clips these characters. I need to create a view that perfectly matches a Figma text component in terms ...
1
vote
1
answer
140
views
UIFontMetrics not working for Custom Fonts in iOS 17 with Xcode 15
I'm creating new app and in that I've to use custom fonts. I'm also planning to support dynamic font types. That's why I'm creating common structure which will provide me fonts at different places of ...
1
vote
1
answer
61
views
UITableViewCell programmatical constrain issue
I I am creating UITableViewCell using programmatical constrains. The call has a cardView and a button. The cardView alone works fine. But once I add UIButton to there then I can see the error on the ...
-1
votes
1
answer
59
views
Render text over image in several lines
I am working on a Swift project where I need to add a rotated watermark text to an existing UIImage. I have implemented a function that uses UIGraphicsImageRenderer to draw the image and apply the ...
-2
votes
1
answer
26
views
How to use `updateTraitsIfNeeded` - when to call it?
There's a new function updateTraitsIfNeeded() available for iOS 17+ and I'm wondering - what is its use case, when should I call it? The documentation seems to be empty.
0
votes
0
answers
20
views
OTP screen problem, while entering and deleting characters [duplicate]
I'm currently working on one project and I need to implement otp code there. I have searched for the screen setup in swift and found some code, but it does not correspond to all my needs.
func ...
0
votes
0
answers
46
views
Firebase "Missing required module 'FirebaseFirestoreInternalWrapper'", when i import FirebaseFirestore in my ios app
Everything is ready like firebase, firebase was installed by SDK's. Everything is included like import FirebaseCore , and FirebaseApp.configure(). Maybe I should write in some another context, guess ...
0
votes
0
answers
52
views
SwiftData with UIKit - Data is lost and errors are thrown when I save different models
I have a bag model and a disc model. The disc can be added to a "cart" or a "bag"
The issue I am getting is when I save a disc to the cart. It saves but completely deletes all of ...
0
votes
0
answers
21
views
How do I know the exact HealthKit Fields (such as stepCount, runningFields) that are updated by the apple watch? [closed]
I'm new to Swift development and currently working with Swift 5 and UIKit. I'm interested in integrating HealthKit into my app and specifically want to understand the interaction with an Apple Watch. ...
-1
votes
1
answer
105
views
iOS 17 UIImageView tintColor issue
Applying color picked from UIColorPickerViewController to UIImageview's tintColor(a color having kCGColorSpaceModelRGB ColorSpace),
then getting tintColor from that same UIImageView is always giving ...
0
votes
1
answer
52
views
How do I get the width of the iOS keyboard with UIKit?
Is there a way to get the width of the system keyboard on iOS with UIKit? When the device is in landscape mode, the keyboard doesn't extend all the way to the end of the screen. Specifically, I want ...
0
votes
1
answer
54
views
Custom stack view alignment
import UIKit
import TinyConstraints
final class CountDownStackView: UIStackView {
func configure(withData data: [[String]]) {
data.forEach { rowData in
let ...
0
votes
0
answers
25
views
I can't customize the TabView as I want it to be with SwiftUI/UIKit [duplicate]
I absolutely can't customize the TabView as I want it to be. I can have the "unselected item" in red or the "background" in black + the "border" in yellow but not all of ...
1
vote
1
answer
34
views
Blur Effect at Top of Screen When Scrolling in UIScrollView
I'm encountering a problem where a blur effect appears at the top of the screen when scrolling in a UIScrollView. Despite my efforts to resolve the issue, I haven't been successful. Below are more ...
1
vote
4
answers
155
views
iOS SpriteKit how to make a touch fallthrough?
I need to make a sprite node to ignore touch, so that it fall through to other nodes behind it (lower z order).
In UIKit this can be done by overriding hitTest, but there doesn't seem to be a way here ...
0
votes
2
answers
72
views
How to allow a CLICK, through a UITableView, to buttons behind?
Imagine a large table view that's mostly transparent, with some elements here and there. (Perhaps there's a large gap between cells, or, picture the cells being mainly transparent with only a couple ...
0
votes
2
answers
37
views
UiNavigationController - title in navigation bar is off-center when right side has 2 buttons
I'm using a UINvagigationController for my app, with every page setting their own title and left and right buttons.
Worked perfectly until I needed two buttons to the right. Just setting them as bar ...
0
votes
1
answer
100
views
SwiftUI Spotlight / Speech Bubble / Tooltip component over a wrapped UIView
So basically my View consists of a SwiftUI ZStack that holds all of my components. One of this components is a UIViewRepresentable wrapper that adapts the UIKit view (that comes from a 3rd party ...
0
votes
0
answers
31
views
Correctly fetch ViewController interfaceOrientation
I am using the following code to retrieve interface orientation of custom UIViewController (which is not a navigation/tabview controller).
public var windowOrientation: UIInterfaceOrientation {
...
1
vote
1
answer
83
views
SwiftUI detect top notch and safe area insets
I am looking for a pure SwiftUI based solution to determine whether the iOS device has top notch based on the safe area insets of the root view. While this is easy to determine in UIKit, for SwiftUI ...
0
votes
1
answer
45
views
Navigating back to a UIKit View from SwiftUI View
I am working on refactoring the sign-up and I am having an issue with navigating back to a UIKit view named WelcomeViewController() from a SwiftUI view named SignUpView().
Here is the code snippet ...
0
votes
1
answer
36
views
How can I use my SwiftUI components in my UIKit project?
I started working in UIKit at first and started to work on SwiftUI due to requirement.
Now I have a framework with my custom components like button, textfield etc..
I want to make my SwiftUI framework ...
1
vote
1
answer
28
views
Can I set a Fixed Order for a UIMenu?
I have a UIMenu in my app that I am populating in a specific order. I want the menu to always appear in the order that I populated it in.
However, the automatic behavior of UIMenu displays the menu ...
0
votes
0
answers
42
views
UICollectionView + UISearchController - How to achieve smooth scrolling animation when hiding search bar?
I notice that, normal implementation for UICollectionView + UISearchController, will not able to achieve smooth scrolling animation when hiding search bar.
As you can see in the below video, when we ...