cgrect Questions
3
I was wondering if there was any way to combine a CGRect with another CGRect to get a new CGRect. Does swift have any preset functionality to do this or is there another way of achieving this?
2
Solved
I'm using a "RectGetter" to get the CGRect of a View.
Like this:
Text("Hello")
.background(RectGetter(rect: self.$rect))
struct RectGetter: View {
@Binding var rect: CGRect
var body: some ...
7
Solved
How can I, given two different CGPoints, turn them into an CGRect?
Example:
CGPoint p1 = CGPointMake(0,10);
CGPoint p2 = CGPointMake(10,0);
How can I turn this into a CGRect?
Zeralda asked 11/11, 2011 at 22:41
1
Solved
I have found the following problem and unfortunatly other posts have not helped me to a working solution.
I have a simple app that shows the camera preview (AVCaptureVideoPreviewLayer) where the vi...
Smelser asked 25/9, 2021 at 17:15
5
Solved
I am creating an image frame using CGRect. I want to center the rectangle that is created.
I've looked on here, as well as in the Apple documentation for the best way to do this, and found CGRect...
Hearing asked 6/8, 2014 at 9:53
8
Solved
I have a UIView, in which I have arranged UIButtons. I want to find the positions of those UIButtons.
I am aware that buttons.frame will give me the positions, but it will give me positions only ...
10
Solved
The problem sounds easy but it is making me crazy.
I've created a white view in IB that's called iBag and by constraints it's size depends on screen size.
Now I want create a new UIView programm...
4
Solved
I am trying to check if a CGRect is null in my property getter and if it is, load a value by default, however, in my init method, when I use the property, it returns zero for all values.
Here is m...
Electrolyte asked 18/4, 2013 at 16:48
4
Solved
I've got a CGRect, and I'd like to adjust it with a UIEdgeInsets.
It seems like perhaps there might be a built in function that does this. I've looked for a CGRectAdjustByInsets or functions with ...
Anthracoid asked 2/1, 2015 at 11:44
13
Solved
I change the position of a UIView with following codes without changing size of the view.
CGRect f = aView.frame;
f.origin.x = 100; // new x
f.origin.y = 200; // new y
aView.frame = f;
Is there ...
13
I am trying to implement a animation for a rectangle to perform modal vertical swipe.However, when I try to compile the code I get the following error "Swift 4 Expression type '@value CGRect' is am...
5
Solved
In a piano app, I'm assigning the coordinates of the black keys.
Here is the line of code causing the error.
'blackKey' and 'whiteKey' are both customViews
blackKey.center.x = (whiteKey.frame.ori...
Parik asked 16/8, 2011 at 6:35
3
Solved
When I created CGRect in Objective-c and I didn't want to set each value, I created in this way:
(CGRect){CGPointMake(0, 0), [UIScreen mainScreen].bounds.size}
Do you know a similar way in swif...
1
Solved
I am building a UIView that has an overlaid box and the end-goal is to have the QR Code reader only fire when the QR falls within the box. I know that I need to set the .rectOfInterest() to be the ...
Grozny asked 20/4, 2019 at 19:2
7
Solved
How can I increase the size of a CGRect by a certain percent value? Should I use some form of CGRectInset to do it?
Example:
Assume I have a CGRect: {10, 10, 110, 110}
I want to increase its size (...
Commentator asked 13/11, 2014 at 21:36
3
Solved
I'd like to create a dash border around a view, which can be moved/rotated/scaled.
Here's my code:
func addBorder() {
let f = selectedObject.bounds.applying(selectedObject.transform)
borderVi...
Metencephalon asked 1/10, 2018 at 10:58
9
Solved
This question was originally asked for the objective-c programming language. At the time of writing, swift didn't even exist yet.
Question
Is it possible to change only one property of a CGRect ?
F...
Brade asked 2/3, 2012 at 17:19
4
Solved
I needed to check wether the frame of my view is equal to a given CGRect. I tried doing that like this:
CGRect rect = CGRectMake(20, 20, 20, 20);
if (self.view.frame == rect)
{
// do some stuff
}...
Baptism asked 13/10, 2012 at 22:12
8
Solved
Is there a way to verify if a CGPoint is inside a specific CGRect?
An example would be:
I'm dragging a UIImageView and I want to verify if its central point CGPoint is inside another UIImageView.
Paddle asked 7/11, 2011 at 14:19
1
Solved
From the Apple Documentation, the maxY of a view is
The largest value for the y-coordinate of the rectangle.
The maxX of a view is
The largest value of the x-coordinate for the rectangle.
...
Noellanoelle asked 1/7, 2018 at 16:6
0
In my project I'm getting a lot of crashes for
CALayerInvalidGeometry; CALayer bounds contains NaN:
but I am not able to reproduce the crash and only pick it up in Fabric so it's not possible...
1
Solved
How do I rewrite the code below?
self.view.frame = CGRectOffset(self.view.frame, 0, movement)
'Offset' has been replaced by 'offsetby'
When I replaced it with the so called "solution":
self...
5
Solved
I am new to iOS. Can any one please explain what the use is of CGRectZero and where it is used?
Gerome asked 6/3, 2014 at 7:32
5
Solved
Anyone has a good solution for the following task?
I need to check if a CGRect is inside another CGRect and return a CGPoint, that gives the offset if the rect window is outside in any dimension f...
3
Solved
I was writing a program in swift and just now I noticed that I can directly access a CGRect frame's width and height properties directly without using the CGSize width and height. That is I am now ...
1 Next >
© 2022 - 2024 — McMap. All rights reserved.