Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
79 views

extension CGPoint { var coordx : String { let xx = round(x * 10 * scaleFactor)/10 //No problem here return "\(xx)" } var coordy : String { let yy = ...
Victor Engel's user avatar
  • 2,135
0 votes
1 answer
41 views

I have the following view set up: Where the anchor point for V3 is (0, .5) and it can be rotated by a UIPanGestureRecognizer that's attached to V4. I'm trying to translate a point on V4 to V1s ...
Ser Pounce's user avatar
  • 14.3k
0 votes
0 answers
150 views

I’ve detected specific part of image (blue ball) and I need to warp this part from upper-point to lower-point. I’ve found WarpGeometryFilter but the problem is that it warp full image to point of ...
Diana's user avatar
  • 713
0 votes
2 answers
258 views

I've created two CGPoints and a connecting line between them. My aim is the following: When I drag the second CGPoint with a SwiftUI DragGesture() the line will follow it (as if it's connected to it). ...
Kurt's user avatar
  • 91
1 vote
2 answers
351 views

I have array of CGPoint indicated in red. I must connect all consecutive points with CGRect as shown in the rough figure to form an array of CGRect. Consider all rect has a constant width and each ...
iOS's user avatar
  • 3,634
0 votes
2 answers
260 views

I working with UIBezierPath and shape detection. For painting im using "UIPanGestureRecognizer". Example of code: My shape definder var gesture = UIPanGestureRecognizer() . . . view....
wprpovhtguetbfdotm's user avatar
2 votes
1 answer
94 views

Goal I want to set the position of a child node in my game's scene using the position property of SKSpriteNode and pass an inline mathematical expression as the argument to the y parameter. The child ...
michael.yql's user avatar
1 vote
1 answer
273 views

As you can see in the Image attached, there are red and green Views on the screen, I want to add a Line between them. How can I do that?
Akash Neeli's user avatar
0 votes
1 answer
1k views

I want to centre a rectangle in a view, i try using midX or midY but the view still not centre this is how i setup the rectangle the overlayView have width = 414 and height = 688 override func ...
ferryawijayanto's user avatar
0 votes
0 answers
71 views

in my code, I can draw a line by following user touch. the issue is whenever I draw another line, the previous line is gone. how can I always show all lines? please guide me for the same. CanvasView....
Dhiren's user avatar
  • 51
0 votes
1 answer
1k views

I have a class called CategoryCell which us UICollectionViewCell. On the CellForItemAt function: func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> ...
Xin Lok's user avatar
  • 529
1 vote
1 answer
2k views

fellows! I'm trying to make an animation of an image in my tableViewCell. My intent is to get an imageView that is in a tableViewCell, add it to exactly the same place in a view, and then use scale ...
imnikita's user avatar
1 vote
1 answer
770 views

Trying to find nearest points between start and end point. Points Array : let pointsArray = [(10.0, 10.0), (70.0, 10.0), (10.0, 200.0), (70.0, 200.0), (73.0, 10.0), (133.0, 10.0), (73.0, 200.0), (133....
Code cracker's user avatar
  • 3,176
0 votes
1 answer
108 views

In the below UI, I need to show Spotlight where we are going to show some feature of the button from UIAlertController. So to add a mask to the UIWindow for that button I need it's exact location. How ...
Anirudha Mahale's user avatar
0 votes
1 answer
315 views

I have created a graph drawing points and creating a UIBezierPath between those points, but now I want to add a gradient to the plotted lines (similar to picture). The issue is I need a frame for the ...
aFella's user avatar
  • 205
-2 votes
1 answer
197 views

It's my first program in Swift. The function returns two random locations (CGPoints) which are points on the perimeter of a circle of radius = variable (passed in by the calling program). The two ...
Abdul Ahad Akram's user avatar
1 vote
1 answer
69 views

I'm moving my first steps into SpriteKt and found this apparently weird behaviour of the SkSpriteNode.position property: it should be a CGPoint, but when assigned and read back, it behaves differently ...
Luca's user avatar
  • 303
3 votes
1 answer
3k views

I have a view placed somewhere in my ContentView. I want to be able to drop images onto it. So I've added and .onDrop to it. In UIKit, I would use universeView.convert(point, to: targetView). How do I ...
niklassaers's user avatar
  • 8,878
0 votes
1 answer
745 views

I've been making an iOS camera app and trying to solve this problem for two days (but cannot solve this). What I'm working on now is change the focus and exposure automatically depending on the user's ...
zzzzou's user avatar
  • 197
3 votes
2 answers
798 views

How difficult can it be to access x and y coordinates from NSPoint ... Can't believe it. I get an NSPoint from following call: var mouseLoc = [NSEvent .mouseLocation] I need to access x and y ...
user688262's user avatar
-1 votes
1 answer
212 views

I want my swift code to undo the last drawn stroke. I have seen something like the use of PopLast() but connecting that with image view pic does not work. To do the drawing I am using GetImageContext. ...
joe buck's user avatar
0 votes
0 answers
155 views

I want to remove everything written imageview pic. I have tried something like pic.Clear() but its not being recognized. I dont know what else to do. The only other thing I can think off is to somehow ...
joe buck's user avatar
0 votes
0 answers
177 views

I am trying to get random CGPoints along the 'outer contour' of UIView so that I will be able to draw UIBezierPath line over obtained CGPoints. For example, get CGPoints from below red dots which I ...
Matthew So's user avatar
0 votes
1 answer
54 views

My swift code goal is to just draw lines on a image view. Right now when you pick up your hand from the image view the drawing disapers. When your hand is pressed down it works its just when your hand ...
joe buck's user avatar
4 votes
3 answers
674 views

Hello I found nice solution without array from here works OK @propertyWrapper struct EncodablePoint: Encodable { var wrappedValue: CGPoint enum CodingKeys: CodingKey { case x ...
Baldo's user avatar
  • 41
1 vote
1 answer
868 views

My swift code below draws a horiziontal way the horizontal line is at a angle that does not change. Think like a x axis. I want to draw a line in the exact opposite way. Think of the y axis. The line ...
joe buck's user avatar
3 votes
2 answers
436 views

I have a loop below that is supposed to detect if a view in an array of UIView's overlap with each other at all. If they do, then adjust their center value. Each view is 25x25. func drawCircles() { ...
narner's user avatar
  • 3,221
3 votes
1 answer
1k views

We have a function that creates a path based on an array of CLLocationCoordinate2D, this array contains 4 coordinates, and will create a path with the shape of a square: func createPath(coordinates: [...
SwiftyJD's user avatar
  • 5,501
0 votes
1 answer
352 views

I'm working on a macOS app with SwiftUI that should be able to create, arrange and delete geometric shapes on screen. The creation and dragging of shapes already works pretty well using a context menu....
Tony's user avatar
  • 13
0 votes
1 answer
90 views

I have 2 viewControllers: VC1 VC2 (VC2 presented on top of VC1) I need to know in advance the (CGPoint) position of a subview of VC1 whenever I am in VC2 so that I can apply an animation dismissing ...
user avatar
-5 votes
1 answer
358 views

I have some code that is supposed to swipe a sprite in any direction taking in an initial value of a CGPoint. I tried setting up a variable for this as var initialLocation:CGPoint = 0 I know this ...
GAVIN ALFARO's user avatar
-3 votes
2 answers
1k views

I have code that loops through an array of doubles and creates a CGPoint from the double and the index of the array. However, I can't figure out how to place the resulting CGPoints into an array. ...
user6631314's user avatar
  • 2,050
1 vote
4 answers
171 views

Please forgive this naive question, but is there any direct way to create a cgpoints from a coordinate pair without extracting the x and y value separately. I know you can do: CGPoint point = ...
user6631314's user avatar
  • 2,050
-1 votes
1 answer
343 views

I am trying to convert JSON from an API into an array of cgpoints that I can use in core graphics. The JSON looks like: {"date":"2017-01-05","open":119.34,"high"...
user6631314's user avatar
  • 2,050
-1 votes
2 answers
996 views

My swift code below is trying to rotate a imageview around another imageview. I want the rotation to work just like a game spinner. A link to something close to what I am looking for is https://www....
user avatar
0 votes
0 answers
160 views

I'm trying to get the player to move to the direction of the player touch without stopping, or direction of swipe would be better because it seems more natural. However I only can find out how to do ...
Mugs's user avatar
  • 339
1 vote
1 answer
1k views

I want to rotate a image in this code would be pic1. I placed a image below of what I am exactly looking for. I don't want to rotate the entire image I want to rotate from the bottom left corner of ...
user avatar
0 votes
1 answer
1k views

The user taps a cell, I get the touchLocation, create and then animate a new UIWindow to the center of the screen. The problem is when the new window (purple) appears on screen instead of its center ...
Lance Samaria's user avatar
3 votes
2 answers
1k views

I have an array of CGPoints: let points = [(1234.0, 1053.0), (1241.0, 1111.0), (1152.0, 1043.0)] what I'm trying to do is find the center of the CGPoints. So I can place an object at the center of ...
SwiftyJD's user avatar
  • 5,501
3 votes
3 answers
2k views

We have an array of CGPoints: let points = [(1234.0, 1053.0), (1241.0, 1111.0), (1152.0, 1043.0)] What I'm trying to do is get the CGPoint with the highest x value and the one with the highest y ...
SwiftyJD's user avatar
  • 5,501
0 votes
1 answer
280 views

I have an array of 3 CGPoints, what I'm trying to do is create a CGRect based on those CGPoint coordinates. I need this CGRect to set the bounds of a view so it can "zoom in" to those coordinates as ...
SwiftyJD's user avatar
  • 5,501
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
2 answers
206 views

I've got multiple UIImageViews, spread across in a view. @IBOutlet var leftIVs: [UIImageView]! @IBOutlet var topIVs: [UIImageView]! @IBOutlet var rightIVs: [UIImageView]! I'm trying to create a ...
mobs_boss's user avatar
  • 862
0 votes
1 answer
184 views

I am drawing a line with Path, and on that line I want to have a circle if I play around I can get the circle on the line of course. However I do not understand why this code does not put the circle ...
PaFi's user avatar
  • 920
4 votes
1 answer
4k views

I want to get position(point) of my navigation item which is a button. If I can get this point I will be able to add a guide circle on my app. But I can't get this point right. let point = ...
Hilalkah's user avatar
  • 1,055
4 votes
1 answer
2k views

I am trying to convert UIBezierPath to SwiftUI Path I managed to do manually, by editing the bellow code: From: UIBezierPath controlPoint1: CGPoint(x: 1226.38, y: 0), controlPoint2: CGPoint(x: ...
Mane Manero's user avatar
  • 3,908
0 votes
0 answers
33 views

Thought it'd be convenient to use tuples to set CGPoint properties, but I can't seem to figure out what swift wants me to do: infix operator = {associativity right precedence 150} // 1 extension ...
GoldenJoe's user avatar
  • 8,092
0 votes
1 answer
24 views

my code below initializes 2 different imageviews pg and tim. I have create a seperate var for the UIPanGestureRecognizer to be used for each imageview and func to move the imageview around using ...
user avatar
0 votes
0 answers
21 views

I the storybook, there is a main UIViewController of type ScrollView, it includes several UIViews. In the code I have an NSArray that contains all the UIViews that are withinvthe scrollView. for some ...
Amrmsmb's user avatar
  • 11.6k
0 votes
1 answer
161 views

My code is trying to use a slide value to change the width of a line. Right now It is not working. I only want dont want lines drawn before the value is change to be effected only new lines after the ...
user avatar

1
2 3 4 5
11