Skip to main content
Filter by
Sorted by
Tagged with
0 votes
1 answer
67 views

Hi all I'm trying to set the offset limits so that the image during the dragGesture never exceeds the outlines of the mask... Thanks to the help of Benzy Neez I obtain a scaleOffset value that I use ...
kAiN's user avatar
  • 2,823
1 vote
0 answers
55 views

I want to change the size of the UITextField programmatically. Actually what I want to do exactly is this UIAlertView inside I have a UITextField. I want to increase the size of this UITextField. ...
BurakEryvz's user avatar
-1 votes
2 answers
558 views

I have a UIStackView that includes either three or four custom UIButtons. All buttons are completely rounded, the left and right buttons are slightly bigger than the center one/two. Somehow, I can't ...
cameloper's user avatar
  • 316
1 vote
0 answers
394 views

Been reading the docs and found out that CGSize can take in negative values since it's more of a "vector" representation. What's the purpose of this? Not saying that vectors can't be ...
Ray Tso's user avatar
  • 566
1 vote
2 answers
1k views

I have a UITextView containing an NSAttributedString. I want to size the text view so that, given a fixed width, it shows the entire string without scrolling. NSAttributedString has a method which ...
francybiga's user avatar
  • 1,138
0 votes
1 answer
3k views

Sorry in advance for the probably silly question - I'm a beginner I'm generating a new UIView in viewDidLoad, providing some constraints to anchor it over the main view. When it comes to understand ...
MRoot's user avatar
  • 45
0 votes
2 answers
173 views

The Apple doc for func projectPoint(_ point: simd_float3, orientation: UIInterfaceOrientation, viewportSize: CGSize) -> CGPoint says: viewportSize The size, in points, of the view in which the ...
Lance Samaria's user avatar
0 votes
2 answers
2k views

I have large images uploaded by users in Swift and I need to resize them all to 100x100px to create thumbnails to store in my server. So far I have found that this resizes an image given a CGSize: ...
Rage's user avatar
  • 970
0 votes
1 answer
929 views

If I want to display a 16:9 horizontal video inside a cell I use the dimensions: let videoHeight = self.frame.size.width * 9 / 16 contentView.addSubview(thumbnailImageView) thumbnailImageView....
Lance Samaria's user avatar
0 votes
1 answer
2k views

The aspect ratio for a 1080p hd video is 16:9 and to set a frame for the video in a cell so that it would fill it up completely I would use view.frame.width * 9 / 16: func collectionView(_ ...
Lance Samaria's user avatar
0 votes
1 answer
91 views

My swift code below is positioning objects. I want both objects to be to cover 10 percent of the x axis each. So the first object which is fight[0].image and the 2nd object is fight1.image. As you can ...
user avatar
0 votes
0 answers
400 views

Im trying to calculate the width of this view not the entire screen but i'm getting the whole screen width not the page sheet view on iPad. On iPhone it is fine because the page sheet covers the ...
Kegham K.'s user avatar
  • 1,614
1 vote
2 answers
1k views

In UICollectionViewDelegateFlowLayout when I am using: func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: ...
Amit's user avatar
  • 4,896
2 votes
1 answer
729 views

I have been struggling to set create this, I have read numerous posts on here, but do not understand what I am doing wrong. I have a UITextView. I would like it to expand in height, up to a number ...
Tim J's user avatar
  • 1,251
-2 votes
2 answers
394 views

I have tried everything I found on StackOverflow but nothing worked really. I need to calculate boundingRect's height for any/random UIFont available. The code is simple (I modified some of the code ...
sabiland's user avatar
  • 2,610
1 vote
0 answers
2k views

I have got this code: CGRect _frame = container.frame; CGFloat height = _frame.size.height This code gives me the height of the view but in what units? Is there a way to convert it to pixels or ...
Melron's user avatar
  • 459
0 votes
1 answer
233 views

This is my code : @IBOutlet weak var imageScroll: UIScrollView! ... imageScroll.contentSize = CGSize(width: imageScroll.visibleSize.width * 5, height: imageScroll.visibleSize.height) It's OK. If I ...
xptrip's user avatar
  • 59
1 vote
1 answer
50 views

I have a 3 columns and multiple rows Collection View. In my sizeForItemAtIndexPath, I return a dynamic CGSize like this : return CGSizeMake(_sponsoredCollectionView.frame.size.width/3 - 7, (...
Hyder's user avatar
  • 1,173
0 votes
1 answer
81 views

If I do view.layer.shadowOffset = CGSize(width: -1, height: 1) what exactly does the numbers -1 for width, and 1 for height mean? How is the shadow determined from the CGSize passed? I found the ...
matchifang's user avatar
  • 5,490
0 votes
1 answer
796 views

I have a collectionView cell that has a label and an imageView. The imageView is 8 points from the top of the cell, the top of the label is 8 points from the bottom of the imageView, and the bottom of ...
Lance Samaria's user avatar
2 votes
1 answer
2k views

I have an infinite scroll in my UICollectionView and I've noticed that the way I estimate my cell height is the bottleneck of my collection view. It causes some long delays the more I scroll my ...
Kirill's user avatar
  • 909
0 votes
1 answer
229 views

I'm currently working on an App where Meteors should spawn randomly as enemies. I have this code: let randomXStart = random(min: CGSize, max: CGSize) let randomXEnd = random(min: CGSize, max: CGSize) ...
Moritz Sass's user avatar
-3 votes
1 answer
336 views

Click here for image. Need help fitting label so that the left and right side fills. Code is at the bottom. @IBOutlet weak var header: UILabel! override func viewDidLoad() { header....
booak55's user avatar
  • 111
0 votes
0 answers
180 views

I run my app on my iPhone 7 + device and when I try to log the Scale and screen bound sizes, What I get is related to iPhone 5/5s/5c/SE, NOT to my iphone 7 plus specification. This is what I get in ...
Reza.Ab's user avatar
  • 1,215
5 votes
4 answers
12k views

I have UIButton, which title is dynamic changes. Button size should changes with title size and will be equal title size. How to do this programmatically in Swift?
Dmytrii G.'s user avatar
0 votes
0 answers
198 views

I have a total newbie question with swift. I am running into an obstacle when sizing my nodes. I would like to size my nodes like this... player.size = CGSize(width: 60, height: 60) This comes out ...
c3pNoah's user avatar
  • 65
0 votes
3 answers
2k views

I have a UIView, which acts as a container and the width of this container needs to change dynamically based on the longest String. So I want to get CGFloat/CGSize based on String length, is it still ...
Maja's user avatar
  • 59
-3 votes
1 answer
1k views

I'm having an issue with the youtube video by Jared Davidson. https://www.youtube.com/watch?v=1_daE3IL_1s At exactly 7 minutes, he writes the code line: self.ScrollView1.contentSize = CGSizeMake(self....
Hussein Esmail's user avatar
6 votes
2 answers
2k views

I'm programming a small game in Swift and SpriteKit, which is made of a boxes (4 * 8). Scene (1024 * 768) boxes (964 * 452) row1 (932 * 25) col1 (24 * 116) col2 (...
SpilledMango's user avatar
1 vote
1 answer
3k views

The resolution of the original image selected in imagePickerControllerd is 2448x3264. I want to keep the ratio and change the resolution. I need help.
travisIcecream's user avatar
0 votes
2 answers
2k views

I want to create constants in header file of type CGSize so I can use this size anywhere in my app just using constantName.height and constantName.Width. I would appreciate if you provide syntax for ...
Hiren Prajapati's user avatar
0 votes
5 answers
1k views

`lblAddress.frame.width` `lblAddress.frame.size.width` I have searched so many time but still i haven't point out...what is difference between lblAddress.frame.width AND lblAddress.frame.size.width. ...
Foolish's user avatar
  • 159
0 votes
1 answer
395 views

I write function that return size of the cell for the UICollectionView. fileprivate func getCellSize(with row: Int) -> CGSize { let percentage: CGFloat = row == 0 ? 0.8 : 0.2 ...
Oleg Gordiichuk's user avatar
1 vote
1 answer
106 views

Right now newSize just creates a white box. I would like newSize to be a blue box. How do I add uiColor to newSize? let newSize: CGSize = CGSize(width: 900, height: 900) ...
user avatar
0 votes
1 answer
653 views

I need to render a PDF for a given metric size. I can render a PDF in iOS coordinates but how can I convert i.e. 1mm to points. Thanks
user3032502's user avatar
18 votes
1 answer
43k views

After updated Xcode8 not able to set contentSize for ScrollView. I can't able to use CGSizeMake. Can anyone help me? I have tried scrollView.contentSize = CGSizeMake(self.view.frame.size.width, 700)...
Govindharaj Murugan's user avatar
18 votes
2 answers
4k views

New Edit Below I have already referenced AVMutableComposition - Only Playing First Track (Swift) but it is not providing the answer to what I am looking for. I have a AVMutableComposition(). I ...
impression7vx's user avatar
8 votes
1 answer
7k views

I have update my Project to Swift3 in Xcode 8 and it comes this error but I have no idea what I can make there. I have already search in google but nothing founded. Have anyone an Idea what I can make ...
Marshall's user avatar
0 votes
1 answer
219 views

Hi i am reacreating the textsize with these code CGSize textSize = [self.text sizeWithFont:self.font constrainedToSize:self.frame.size ...
Lê Khánh Vinh's user avatar
1 vote
0 answers
133 views

I kept a tableview inside a viewController.ViewController is inside a container view. The problem is that the layout changes on rotation of the device. This is not a constraint issue as it happens ...
Suraj K Thomas's user avatar
0 votes
1 answer
99 views

I have a UIView object in a view controller and wanna add a CALayer object into the UIView object. The auto layout configuration of the UIView object is shown as follows. (Sorry I cannot embed pix yet,...
io̍k-úi TiuN's user avatar
5 votes
3 answers
4k views

CGSize(width: 360, height: 480) and CGSizeMake(360, 480) seem to have the same effect. Is one preferred to the other? What is the difference?
Crashalot's user avatar
  • 34.7k
-3 votes
1 answer
2k views

This must be in documentation somewhere but I cannot find it. What does the .f mean when defining rectangles using CGSizeMake as in CGSizeMake(200.0f, 100.0f);?
user1904273's user avatar
  • 4,774
2 votes
1 answer
713 views

Need your help, I have input CGSize (for example): 200x300. And array with other CGSize's = [20x20, 100x100, 150x150, 200x100, 200x250, 300x300...]. Please help me to find best item in array that have ...
LightNight's user avatar
  • 1,625
-4 votes
1 answer
185 views

My app retrieves image from URL, but I need to change the image size before it appears on the user interface in my tableview. this is my code in my tableViewController: import UIKit import Firebase ...
user5396291's user avatar
6 votes
2 answers
2k views

I need to have my banner ads stratched/filled all across the width of the screen at the bottom. My code is working for the devices with the width equal to either MOPUB_BANNER_SIZE.width or ...
Nika Kasradze's user avatar
6 votes
4 answers
2k views

I have an iOS app with a UICollectionView which presents cells horizontally. In each of the cells, I have added one simple label (for now). These labels are showing names, sometimes the names are ...
Supertecnoboff's user avatar
1 vote
2 answers
105 views

I would be grateful if anyone could help me to solve an issue with image saving. I've got an app which contains recipes with corresponding images. I need to resize them in order to preserve memory and ...
AOY's user avatar
  • 355
0 votes
2 answers
966 views

I have a UIImageView that display a UIImage with the content mode set with UIContentModeScaleAspectFit. The imageview is as width as the screen. I want to resize the imageview without changing image ...
Boris88's user avatar
  • 297
1 vote
2 answers
923 views

Trying to set a scrollView's contentSize and I've run across this issue (Xcode 6.4)... Both of these work perfectly: scrollView.contentSize = CGSize(width:self.view.frame.width, height:1000) ...
RanLearns's user avatar
  • 4,176