Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
1 vote
1 answer
147 views

Round Corners of UIContexualAction

I am trying to round corners of UIContexualAction like in photo. Is there ways i can do it without any frameworks? result i want to see I know that here was some questions like this but answers there ...
Айдос Куатбек's user avatar
0 votes
0 answers
141 views

How to create a View where circular profile image is split between two views, where second view has only top right, top left corner radius in swiftUI

I'm learning SwiftUI, and my Profile Screen requires a view similarly shown in this image: https://i.pinimg.com/originals/1c/21/96/1c2196706b947cc9e8f656da98fd2c80.jpg I have managed to set background ...
SwiftNewbie's user avatar
4 votes
2 answers
135 views

Shadow and Corner Radius at the same time doesn't show in swift

I have a CameraView which has two button 1.takePictureButton 2.recordVideoButton. I want to add corner radius and shadow in the CameraView. So I add a innerView and add it as subview of CameraView. In ...
T33's user avatar
  • 95
1 vote
1 answer
187 views

How to provide a cornerRadius to a UIImageView with contentMode set to scaleAspectFit

I have an image which has contentMode set to scaleAspectFit with a cornerRadius but i don't get the rounded corner but when I set the contentMode to scaleAspectFill it works. My question is i still ...
chevi99's user avatar
  • 143
0 votes
0 answers
66 views

I want to give cornerRadius to an arc made of UIBezierPath

I made an arc using the UIBezierPath and I'm going to give it cornerRadius Here's my code let shapeLayer = CAShapeLayer() let path = UIBezierPath( arcCenter: CGPoint(x: rect.midX, y: rect.maxY), ...
jmindeveloper's user avatar
0 votes
0 answers
42 views

CornerRadius doesn't work when fliping UIViewController

My view looks fine before a flip. but when I flip, it looks different than I expected. What should I do to make the corner looks rounded even when I'm flipping it? corner looks bad
MrGarlic's user avatar
-1 votes
1 answer
109 views

only specific corner radius to UIView with constraint?

snap shot before applying corner radius to some corner i code these to get corner radius extension UIView{ func roundCorners(corners: UIRectCorner, radius: CGFloat) { let path = UIBezierPath(...
heli bhadeshiya's user avatar
0 votes
2 answers
102 views

Strange cornerRadius behaviour on UIView from xib

I created a custom Numpad keyboard through xib and wanted to initialize it with a rounded corners. Here is the code I use: import UIKit class NumpadView: UIView { @IBOutlet weak var resetButton: ...
artexhibit's user avatar
1 vote
1 answer
2k views

Add corner radius to view borders Swift

I have a UIView extension with a function that adds borders to specific edges (which I need). On that function, I am also trying to add cornerRadius if the borders are near each other. Here is my ...
poPaTheGuru's user avatar
  • 1,080
0 votes
2 answers
59 views

Swift UITableViewCell separatorStyle breaking autolayout on iPhone MIni

I have a UITableView which has a UITableViewCell which contains a UIImageView. The constraints are setup such that the UIImageView has padding 20 points at the top and sides, and a size ratio of 1:1, ...
theDuncs's user avatar
  • 4,843
2 votes
1 answer
1k views

UIImage with the corner round itself

Due to the auto layout feature, I tried to use UIImage corner radius instead of UIImageView. The corner radius was too thin when the photo was too large, such as 4k x 4k, but when the photo was small, ...
Travgalax's user avatar
0 votes
1 answer
850 views

How to give corner radius in one side to Imageview in swift?

How can I give corner radius in one side to Imageview like zig zag? like in image In this image I want like a large image witch is highlighted in Blue line. If anyone know about this Please help me. ...
Fiaz Hussain's user avatar
2 votes
2 answers
993 views

SWIFT - Setting layer.cornerRadius greater than the view height causes issues

I actually want to add a corner radius to a view on only one side. The radius is supposed to be of full height. This is my implementation. someView.layer.cornerRadius = someView.frame.size.height ...
Faran Rasheed's user avatar
0 votes
1 answer
392 views

Animate maskedCorners in Swift when some corners are always rounded?

I have a rect. Top corners are always rounded. Bottom corners have animation - rounded or not. Previous my solution was to split this rect into top and bottom rects (top one is constant, bottom one is ...
Vyachaslav Gerchicov's user avatar
0 votes
2 answers
398 views

CornerRadius is not Displayed

I have set the corner radius to 10. But the image view does not show corner radius. lazy var imageView: UIImageView = { let imageView = UIImageView() imageView....
udi's user avatar
  • 3,833
45 votes
4 answers
25k views

I have trouble using cornerradius and borders on a textfield in SwiftUI

I have a text field in swiftUI, and in order to make it more appealing I'd like to add a border and have rounded corners. But it doesn't seem to work like it's supposed to (see image). What did I miss?...
Sydney's user avatar
  • 483
4 votes
1 answer
3k views

Round Specific Corners of Stroke/Border SwiftUI

I am working on a SwiftUI project where I need a view to have a border with only some of the corners rounded (for instance, the top left and top right). I added a RoundedRectangle with a stroke and ...
Rosalie W's user avatar
  • 379
1 vote
2 answers
1k views

Round Corners in custom UICollectionViewCell not working in Swift

I have custom UICollectionViewCell and try to round corners for button, which doesn't work. I had the same problem for ViewController and the problem was that I was doing rounding in viewDidLoad ...
Giga Khizanishvili's user avatar
1 vote
1 answer
826 views

Custom UISlider inner bar corner radius issue iOS 14

in my custom UISlider I want to achieve a rounded corner inner bar. I'm using no thumb. it works fine in iOS 13, but in 14 it crashes with error : *** Terminating app due to uncaught exception '...
Iftiquar Ahmed Ove's user avatar
0 votes
1 answer
157 views

UIImageView with cornerRadius is incorrectly cropped

I am trying to add cornerRadius to UIImageView which is rectangle with small height (7pt). UIImageView is incorrectly cropped on the right side. The strange thing is that UIImageView is perfectly ...
Danny's user avatar
  • 4,069
0 votes
0 answers
77 views

UIView frame slightly different when setting corner radius

I am drawing a sequence of UIViews that touch each other's edges. But when I set view.layer.cornerRadius they get slightly out of alignment creating artifacts. Is there some way around this? Minimal ...
Hans's user avatar
  • 2,482
0 votes
1 answer
316 views

Transparent background button with 2 sided corner radius in Swift

I am building my own segmentedControl. It’s a hollow (transparent) segmentedControl. A selected segment has its borderWidth accentuated. Each segment is a button in a horizontal stack. This is what I ...
Eddy's user avatar
  • 315
0 votes
1 answer
327 views

Corner radius to superview subview UIView not shown

Added UIView of (50 height) to superview i.e., UIView a 50 % hold inside remaining outside to superview. After adding corner radius to superview the below half of bottomView is not shown. extension ...
kiran's user avatar
  • 4,409
-1 votes
2 answers
3k views

Top right and top left corner radius is not working properly

i wanted add corner radius for only top corners, when i add corner radius to top corners entire view's width is changing, below is the code which i using. func roundCorners(corners: UIRectCorner, ...
KEERTHI j's user avatar
  • 250
0 votes
3 answers
771 views

IOS Swift card effect image is getting clipped

Following is my code to create CardView and add shadow effect override func awakeFromNib() { super.awakeFromNib() self.layoutIfNeeded() cellBgview.layer.cornerRadius = 15.0 ...
amodkanthe's user avatar
  • 4,522
4 votes
1 answer
3k views

Corner Radius of UITableViewCell Being Reset when Editing

I have a UITableView that has a list of UITableViewCells with custom corner radii. When swiping to edit, e.g. delete/insert, the corner radius is reset back to 0. I've tried to set the corner radius ...
Jordan C.'s user avatar
6 votes
4 answers
3k views

Change cornerRadius of the modal view controller

My goal is to increase corner radius of the modally presented controller to 25. As you can see in the picture it has rounded corners by default but I need them to have greater radius. I've tried ...
Kruger_'s user avatar
  • 71
0 votes
1 answer
523 views

Swift - Set CollectionView corner radius

how do I set a corner radius on my UICollectionView? Just to be clear, I actually mean the CollectionView itself, not the cells. let theCollectionView: UICollectionView = { let v = ...
Chris's user avatar
  • 2,314
1 vote
1 answer
87 views

UICollectionViewCell drop shadow and round corners not working

I have the following code: class ProductCell: UICollectionViewCell { @IBOutlet weak var productImageView: UIImageView! func setup(productModel: ProductModel) { productImageView....
Idanis's user avatar
  • 1,988
0 votes
1 answer
57 views

Edit the int.random to be set by the user and issue with corner radius

I am just getting started with Swift and I would like the user to be able to set the range of the Int.random for example : if he want to have a random number in the range of 0 to 100, he can set it ...
B Car's user avatar
  • 13
0 votes
2 answers
1k views

UICollectionViewCell is not rounding corner

Im trying to make the corner rounded, but when I use cornerRadius, and maskToBouds, it do not works override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath)...
Vinnicius Pereira's user avatar
-2 votes
3 answers
249 views

Wrong shadowPath for some cornerRadius

Found that in some edge cases the shadowPath seems to render the shadow too rounded. I'm applying the same shadow settings to all the subviews, I expected that the UIBezierPath with the same corner ...
Pau Ballada's user avatar
  • 1,608
0 votes
1 answer
2k views

How to Set Corner Radius for Collection View Cells of Different Size

I want to have oval shaped collection cells with width based on the label/text length, but I am having trouble making all the cells look oval. I don't know how to resize based on the label's text ...
Elizabeth's user avatar
  • 153
2 votes
4 answers
1k views

UIButton corner radius not working properly in CustomClass

I've make a custom class for UIButton but in small screen devices e.g. iPhone 5s cornerRadius not working properly You've to looks closer to see the UiButton's cornerRadius is not perfectly rounded ...
steveSarsawa's user avatar
  • 1,650
10 votes
5 answers
15k views

How to set top left and right corner radius with desired drop shadow in UITabbar?

I've spent almost a couple of hours to figure it out. However, it did not happen and finally, I had to come here. Two things are required to be achieved: Firstly I'd like to have a spontaneous ...
Vaibhav Limbani's user avatar
3 votes
3 answers
2k views

Set UIView's corner radius to half of the view's width automatically

I have a few views whose size is not hardcoded, but determined via constraints and I need those views to be round. Is there a way to set the cornerRadius property "dynamically", e.g. depending on the ...
unixb0y's user avatar
  • 1,049
0 votes
1 answer
2k views

layer rounded corners on a Swift

I tried to get a rounded corner with layer.cornerRadius for my segmented control but it does not work for me actually I want to get cornerRadius depending on the frame here is my code func ...
bilel ayech's user avatar
0 votes
1 answer
370 views

Bar Button Item No Corner Radius

I am trying to give this bar button item label a green background and then some corner radius. utcLbl.frame = CGRect(x: 0, y: 0, width: 100, height: 20) utcLbl.text = "\(dateFormatter.string(...
RL2's user avatar
  • 63
1 vote
1 answer
654 views

Setting corner radius through viewDidAppear() or viewWillLayoutSubviews()?

In summary, setting the corner radii to get round left and right edges for my UIButtons in my application works by grabbing the buttons bounds and dividing the height by two in viewWillLayoutSubviews()...
Tony Pendleton's user avatar
-1 votes
2 answers
299 views

How to globally detect device active orientation changes outside of a swift-file?

I am having trouble in figuring out how to update the corner radii in the calculator view controller (see the images in the link at the end of this post). I am setting the corner radius using ...
Tony Pendleton's user avatar
1 vote
2 answers
482 views

Programmatically Setting Corner Radius for UIButtons in Landscape and Portrait Mode for All iPhone and iPad Devices

The app I am working on is a near replicate of Apple's default iPhone calculator app. I am having a hard time in keeping the corner radius set for both the basic operator buttons in portrait and the ...
Tony Pendleton's user avatar
1 vote
1 answer
197 views

Why doesn't cornerRadius.width/2 give me a perfect circle?

Im trying to create a circle from a squared view using this code: self.situationerCircle.layer.cornerRadius = self.situationerCircle.frame.size.width/2.0 situationerCircle.clipsToBounds = true But I ...
tore's user avatar
  • 689
0 votes
0 answers
70 views

Window's cornerRadius and maskToBounds won't work for statusBar if backgroundColor is applied to statusBar

Why cornerRadius and maskToBounds properties won't affect statusBar if I set background color for statusBar? (I'm a beginner in swift) CONTEXT What I want to achieve: I want to set cornerRadius ...
Ryoko's user avatar
  • 195
1 vote
1 answer
1k views

How to Achieve bottom custom Curve and top Corner Radius in UIImageView?

I am working on Profile Design. I want to achieve custom curve on bottom side of image and apply corner radios to Top side. I have tried it with RoundCorners method of UIBeziarPath. but i didn't got ...
Badal Shah's user avatar
  • 7,602
1 vote
2 answers
3k views

Swift 4 - Getting half the width of a button

I'm trying to make a fully circular button. I have created it in code and setup the constraints like this: addButton.widthAnchor.constraint(equalTo: view.widthAnchor, multiplier: 0.2).isActive = ...
Luke Roberts's user avatar
6 votes
4 answers
4k views

Dynamic corner Radius for landscape and portrait

I create UIView Extension with @IBInspectable to set corner radius but when I just rotate my device its not working properly import UIKit import Foundation extension UIView { @IBInspectable var ...
Nirav Hathi's user avatar
  • 1,557
1 vote
2 answers
1k views

how to corner Radius some edges in IBInspectable in swift 4?

so here is the code that is working well let path = UIBezierPath(roundedRect:viewToRound.bounds, byRoundingCorners:[.topRight, .bottomLeft], cornerRadii: ...
Saeed Rahmatolahi's user avatar
0 votes
2 answers
188 views

Apply corner radius to the decreasing button

I have a very good-looking button. import UIKit class NiseButtonVC: UIViewController { var button = MyShrinkingButton() var button2 = UIButton() override func viewDidLoad() { super.viewDidLoad() ...
Sergey's user avatar
  • 37
1 vote
1 answer
4k views

How to apply sharp corner radius with border on UIView in swift?

I want to set corner radius on bottom left and right side with border on UIView. here is code. **issue is it's not display SHARP in 1.5 border ** class BorderView: UIView { override func draw(_ ...
Arjun Patel's user avatar
  • 1,500
0 votes
1 answer
159 views

Here corner is working but shadow is not work in iOS 9 and 10

Here corner is working but shadow is not work in iOS 9 and 10 and iOS 11 both are working fine viewBlueMe.chatCellDesign([.topLeft,.bottomLeft,.topRight], [.layerMinXMinYCorner,....
Harshil Kotecha's user avatar