Questions tagged [uiimage]
The basic image handling class of Cocoa-Touch on iOS. It is Available in iOS 2.0 and later.
9,180
questions
0
votes
1
answer
16
views
Take snapshot from UIView with lower resolution
I'm taking snapshot from a PDFView in PDFKit for streaming (20 times per sec), and I use this extesnsion
extension UIView {
func asImageBackground(viewLayer: CALayer, viewBounds: CGRect) ->...
-2
votes
0
answers
56
views
Define UIImage array size in Swift
I have four buttons that when tapped use UIImagePickerController.
When the user selects an image I want to save it to an array of type UIImage.
var photoArray: [UIImage]
public func ...
-1
votes
0
answers
30
views
Value of type 'UIImage' has no member 'delegate' [closed]
I'm newbie in Swift, I can not call .delegate from UIImage. Can somebody help me please?
Here's my code:
class ViewController: UIViewController, UIImagePickerControllerDelegate, ...
-1
votes
1
answer
33
views
How do you stop the image overlapping the UIImageView
I use SDWebImage do add the image to my UIImageView
if let url = URL(string: user.imageLocation) {
cell.userImageView.borderColor = UIColor.white
cell.userImageView.sd_setImage(with: ...
0
votes
0
answers
32
views
About SwiftUI upload UIimage to Local server
I want to upload my image to local server.When I upload mutiple images, app will crashed.
It is app memory problem.
This is my process
In app
imageStr = UImage.jpegData(compressionQuality: 0.5)!....
0
votes
0
answers
54
views
UIView to UIImage code is not working. It causing an runtime error
I have to convert UIView to UIImage because I want to make a custom marker.
Currently, I'm making an app using Naver Map SDK.
Here is My Code.
let marker = NMFMarker()
marker.position = NMGLatLng(lat: ...
-1
votes
0
answers
36
views
UIImage next to multiline UILabel
I am making an UIView including an UIlabel and an Uiimage (red right arrow).
In the beginning, the red arrow needed 4 pixels from the UILabel.
That was easy to do with auto layout.
But now the ...
-1
votes
0
answers
49
views
Assigning an image to a UIView
I have the base code to programmatically create 5 UIView objects and then drag them to "target view." Right now, I have it so I can change the background colors, but I want to assign an ...
0
votes
0
answers
25
views
Cannot convert return expression of type 'UIImageView' to return type 'UIImage'
I am following along to this tutorial, https://www.youtube.com/watch?v=kbGsI5O9rWY , and I cannot get the code shown at the 6:18 mark to work properly. I am using Xcode 13 and the tutorial is ...
0
votes
0
answers
41
views
Incorrect color in pixel from original image with UIImage
I'm converting an image from original image to 128 x 128 pixels. I tried to retrieve all colors from the original image for each pixel, but why are some colors off? For example, the original photo ...
0
votes
1
answer
31
views
How do I change the Image of only 1 button in Collection View and make all other button Images different in Swift
In my collection view I have songs with play buttons. I want to change the image of my button upon selection and want to make the previous selected button image to revert to default image. The buttons ...
0
votes
0
answers
20
views
Resize and save image on the phone at url not working
on my project I use the following method to resize the image "UIimage":
func resizedAutomatic() -> UIImage? {
var image: UIImage = self
while image.size.width > 800 || ...
0
votes
1
answer
24
views
Converting UIImage to CIImage fails
I'm making video recording iOS app. I need to add timestamp to recorded video thus I convert CMSampleBuffer to UIImage and add timestamp on in and convert it back to CMSampleBuffer. While process of ...
0
votes
0
answers
14
views
fetch last item in binary data set for display
My swifts code goal is to fetch the last image from binary data pic and display it in imageview picture. Right now its cusing a runtime error with indexpath. I did a similar thing with a string and it ...
0
votes
2
answers
28
views
How to animate movement of UIView between different superViews
Hello I am new at swift and IOS apps , I am trying to animate movement of cardBackImage (UIImage) from deckPileImage to the card view, but everything got different superViews and I have no idea how to ...
0
votes
1
answer
38
views
Move UIImage on top of another UIImage in swift
Layout
What i want to achieve:
CardBackImage is a subview of the ViewController. The view is placed somewhere (invisible with alpha = 0), i want to relocate it on top of deckPile and make it visible.
...
0
votes
0
answers
25
views
How to increase quality of rendered image for UIImageView?
I have an UIImageView with contentMode = .aspectFit. I have an image in imageView, which dimension is bigger than size of imageView. User can draw some lines and save them as sublayer. After that I ...
-2
votes
1
answer
39
views
save a image into binary data by creating a image object
In my swift code the goal is to save a image into core data. My code right now is not working. Its not the right type. The code works if it is a string but trying to save it to binary data is not ...
0
votes
0
answers
22
views
SwiftUI, apply drawGesture only when over Image
I'm try to apply the gesture only when the user is over the Image display not when tapped outside the image.
Any suggestion how I can do? this following code draw also when user tap outside the image.
...
1
vote
1
answer
23
views
SwiftUI calculate coordinate of the corner of UIimage
I'm looking to find the correct coordinate x,y of the 4 corners of the image display in the view.
I wrote this code.. to calculate the first top left corner coordinate :
but is wrong .. result should ...
0
votes
1
answer
36
views
fetch last item of core data array
In my swift code below my goal is fetch the last image of the core data array. Right now my code is having a runtime error with indexpath. I dont know if you need to use a index path to do this. I ...
-1
votes
1
answer
32
views
Drawing (to PDF) an UIImage that has been written to a file does not give the same result as drawing the original UIImage
Some context first:
I simply draw a UIImage to a PDFPage by subclassing PDFPage and overriding draw(with box,to context):
override func draw(with box: PDFDisplayBox, to context: CGContext) {
/* ...
0
votes
1
answer
91
views
How to insert signature image into PDF file in Swift?
I'm adding signature through a SwiftSignatureView and it give us UIImage. How can I add it in to PDF file? Here is my code,
func convertToPdfFileAndShare(){
let imageData = sigImage!.pngData()...
0
votes
0
answers
18
views
SwiftUI : How I can delete the UIimage in the View saved as Codable?
I tried to save the image in my memo with as UIImage as Codable protocol.
My code can be a little bit longer, but please refer to it.
1. first one is the NewMemoView that I can make my memo with ...
0
votes
0
answers
28
views
Is there any way to map dictionary of type [NSString: Any] to another [String: Any]
I tried to cast dictionary of type [UIImagePickerController.InfoKey: Any] to [String: Any] type, but it seems it's not possible. The result was nil. I've found straightway to iterate throught original ...
0
votes
1
answer
50
views
Draw UIImage in Rectangle with background color if it doesn't fit in a rectangle?
I'm new to this topic so I want to ask how I can achieve this following behavior: I would like to create a image with a specific size. If the original Image doesn't fit in a square I would like to ...
0
votes
1
answer
91
views
SwiftUI: Round the corners of a UIImage?
I'm using this Extension to take an image of a SwiftUI view (for sharing) but the only problem is my view has a cornerRadius of 10.0 so round the corners, so this image ends up with black non rounded ...
0
votes
1
answer
41
views
iOS Scene can't load any images
This is similar (but not a duplicate, please read) of:
Could not load the "" image referenced from a nib in the bundle with identifier
I have a scene that loads other elements (e.g. ...
0
votes
0
answers
49
views
Outer and inner stroke to SF Symbols image in iOS
Given an SF Symbol image in iOS, such as gear, I configure it with a custom color as follows:
let settingsButtonConfig = UIImage.SymbolConfiguration(pointSize: 26, weight: .semibold, scale: .small)...
0
votes
0
answers
30
views
Why did the UIImageJPEGRepresentation UIImageJPEGRepresentation return weird in lldb?
I was debugging a image size problem , and I use NSLog & lldb's command to print the data size of
[UIImageJPEGRepresentation(thumbImage, 1) length])
and
[UIImageJPEGRepresentation(thumbImage, 0.8) ...
-1
votes
2
answers
80
views
How can I add two images (one at the left and one on the right side) in a button in Xcode programaticly? I need also a title of a button
func setupButtonUI() {
if let detailsImage = UIImage(named: "detalji_icon") {
setImage(detailsImage, for: .normal)
contentHorizontalAlignment = .left
contentVerticalAlignment = ....
0
votes
1
answer
53
views
UIImage(named:) with period loads wrong image (e.g. for SFSymbols)
I want an easy way to load SFSymbol images with configuration, if possible. Else just load the image normally. So I have this extension and I have all SFSymbols I need in in my assetcatalog with the ...
0
votes
1
answer
143
views
How to convert SwiftUI View body to UIImage in ViewController
I am working on this convertion and tried many solutions (extensions and methods) as there are so many questions and answers related to this but nothing helped like I have tried following solutions ...
0
votes
1
answer
85
views
Rotate Image 5 degrees each time user clicks button in swift
I am creating a custom image editor for a project where I am stuck at rotating images by 5 degrees forward and backward.
here is what I have tried so far
1. self.cropImageView.transform =
self....
0
votes
0
answers
34
views
If I put ImageView in Uiscrollview and expanded UiImage as long as you expanded, I thought that one pixel will be visible
If I implement and check, I will not see one pixel and see that the image is smoothed and displayed.
Is there a way to view a pixel?
Is there a property to turn off smoothing to UIImage?
the ...
0
votes
1
answer
89
views
Compress image size to below 1 MB in swift iOS
In iOS swift need to compress image size to below 1 MB by following this thread How to compress of reduce the size of an image before uploading to Parse as PFFile? (Swift) tried with below code it ...
0
votes
1
answer
45
views
Overlay a smaller rectangle on a UIImage
I want to overlay a rectangle within an image. This code below currently works but it returns a rect with a thin frame. I cant change the rect frame width. One way to return a custom rect with thicker ...
0
votes
1
answer
43
views
Can't load image from other asset catalog
I have a Xamarin Forms app which has 2 Asset Catalogs. One of them is part of a library and is called SharedAssets, the other one is part of the iOS project for the app and is called Assets.
The "...
0
votes
0
answers
21
views
Adding gradient behind image returns empty image
I have a round avatar image with a transparent background. I want to create a new round image of the same size out of the initial image, with a gradient background behind it. So it looks like standing ...
-1
votes
1
answer
40
views
How would I position my UIImage centered in my collectionViewCell programmatically?
Basically I merged these two UIImages and then they are shown in my cell. The problem Im having is that the position of the frontImage and size is off. I want to get it to be centered in the cell. The ...
0
votes
0
answers
100
views
get Image from local path in simulator
I'm trying to get the UIImage from the local URL, but it doesn't work.
My someURl, where data is NSSecureCoding?: file:///Users/a19468455/Library/Developer/CoreSimulator/Devices/2FA5B725-9266-429C-...
0
votes
1
answer
83
views
Image from bundle loads ok in SwiftUI but not in UIKit
I have developed a framework that consists of some colors in the asset catalogue. I packaged it in the cocoapod and integrated in another project where I try to access the assets from the framework. ...
1
vote
0
answers
159
views
How to convert ARKit Depth data (CVPixelBuffer) to 16-bit grayscale PNG image file?
According to Apple's official example, I made some attempts. This is my codes:
CGImage extension
//ARSessionDelegate
func session(_ session: ARSession, didUpdate frame: ARFrame) {
let depthMap = ...
0
votes
0
answers
22
views
Swift: Image not cropping with .cropping(to: )
I am trying to crop an image and the output is the exact same as the input. I know where the issue is but I cannot figure out why it is not working.
Here is the func:
private func cropImage(image: ...
0
votes
0
answers
43
views
Flutter how to pass Image to iOS?
I define an Image then put to the Container to show
var image = Image.asset(
"assets/images/IMG_2289.jpg",
fit: BoxFit.contain,
);
Container(width: 300, height: 300, color: ...
0
votes
1
answer
115
views
imageView.image = UIImage(ciImage: ) won't update a second time [duplicate]
Case: I have a UISwitch button in view. When switch is off, the imageView will display a QRCode image generated from a string. When on, it will display a barcode image generated from string. I copied ...
0
votes
0
answers
22
views
What are the pros and cons of using UILabels for the icons in the app instead of UIImages?
Basically I am trying to use a ttf file to render images for my icons in the app.
I know few pros of this approach like:
Its lightweight (app size reduction)
overlaying colors is easier
dynamic ...
0
votes
0
answers
23
views
Swift photo loaded from file rotated 90 degrees [duplicate]
I'm taking UIImages and sending them over iOS' Multipeer framework. Here's the steps I take to do so:
/// Save images to filesystem before sending over Multipeer
func save(image: UIImage) -> ...
0
votes
1
answer
108
views
How to change button image size when button is resized?
I'm trying to set the image size for a button to match the size of the button. To get the actual size of the button, I do this in the layoutSubviews() method. But I ran into the following problem.
...
0
votes
0
answers
102
views
SwiftUI tap on image to select an area - better way than this?
Updating an app I did for a car club that connects their customers (dealerships, parties, firehouse events, town events, tv commercials, magazine ads, etc) with their members to rent out fancy/classic/...