Is it possible to place a CGPoint inside of a UIView as a subview so that when I rotate my UIView, the CGPoint rotates with it.
CGPoints and UIViews
531 Views Asked by Blane Townsend AtThere are 2 best solutions below
lomanf
On
CGPoint (like CGSize or CGRect) are C structures and are not supposed to be "drawable". I mean that they are just math representation of coordinates or geometric "stuff" then is not possibile to append them in your display tree.
If you need to display a "point" into your UIView and you need to control it, just add a child UIView to your parent UIView having a frame of 1px square with a color background (if you need to display it). In this case any spatial modification to your parent UIView will affect the child UIView (even rotation).
Otherwise, if you need to know the position of a CGPoint rotate by an angle relative to another point, please refer to this nice answer that contains the math you need.
Rotate a point by another point in 2D
Ciao!
Related Questions in IPHONE
- UIWebView Screen Fitting Issue
- ios responsive design not working (too wide in portrait orientation)
- Setting View orientation to portrait is ignored
- How do I add custom cells to TableView in Swift?
- UIWebView not loading URL in simulator
- What is the limit for number of subscribers to a stream(publisher's) in opentok/tokbox iOS SDK?
- How to generate request format for WCF web service method for Mac and iPhone
- Difference between gethostname() and [NSProcessInfo hostName]?
- How to force close ipad/iphone keypad when input element is not focused using JS?
- iOS app rejected because of in-app purchase
- iOS coordinates for iPad and iPhone game using spritekit
- What is the best practice when making a storyboard for iPhone and iPad?
- Labels properties changing in Xcode
- Terminating app due to uncaught exception
- Exchange plist data between 2 iPad using iCloud
Related Questions in XCODE
- Using Storyboard Reference
- Getting this message in my console in xcode "Ignoring restoreCompletedTransactionsWithApplicationUsername: because already restoring transactions"?
- Error when creating UIImage
- fade in an bounce animation subview
- How to delete static library ".a" file from xcode project?
- Error in main.storyboard
- Is the compiler Xcode uses to produce Assembly code a bad compiler?
- Using paths bonded to a XCode project to be shared
- How to set the time of Local notification in app to random between two times? (swift)
- "Invalid Signature, code object not signed at all" error
- Alarming memory increase with custom segue
- Display both alertTitle and AlertBody on a custom WatchKit notification
- How to make a CocoaPods project work on OS X El Capitan & Xcode 7 Beta?
- Cannot use CTRL+Drag for making a button action in Xcode?
- Labels properties changing in Xcode
Related Questions in UIVIEW
- Enable user interaction for gesture recognizer during UIView.animateWithDuration()
- Swift - Changing UIView programmatically while keeping IBOutlets (File's Owner)
- Changing UIView's xib file and file owners code on UISegmented controller switch
- Objective c keyboard opens unwillingly
- Create a UIView title of a push view using the index of an array
- iOS CGRect is inside another CGRect
- Drawing in UIView on touch points gives blurr drawing effect on boundaries
- How to vertically center two views & divide the width equally relative to the super view?
- On xib, dragging view will automatically go inside a bigger view
- Make a UIView stick to bottom of the ViewController frame in Swift
- How to convert a UIView to an image
- Draw/Paint like sketch color inside a bezier path in UIView
- Scene Kit: projectPoint calculated is displaced
- How to send a UIView element backwards in Swift
- UIView animation not smooth, jerky on repeat
Related Questions in ROTATION
- Get current rotation in degrees of group in snap.svg
- Change the rotating speed of the circle when the mouse moves using javascript
- WKWebView added as Subview is not resized on rotation in Swift
- Three.js, Camera rotation around a point
- Android screen flips on usb keyboard connection
- Object doesn't moving well in rotation
- Rotating Shape with KineticJS
- Controlling/moving an object in a circular motion in Unity
- Android rotating wheel set end point
- Rotate animation after Translate doesn't work on Android
- Android: Upon Rotation, Current Fragment Disappears (How to Save State)
- Rotation and getBounds() in Phaser
- raphael js drag rotation in Firefox and Internet Explorer
- Rotate Point3D around Unit Vector
- Realistic rotation of a 3D model in libGDX by dragging
Related Questions in CGPOINT
- Failed to use CGPoint, the struct, in Swift
- CGPoint variable initialized in @interface of .m file can't have value
- need to change positioning of labels using cgpoint (swift3)
- Pre Defined CGPoints To Describe Points On the Screen
- SKLabelNode not displaying the right CGPoint
- return CGRect on selector causes crash
- Find the CGPoint of a specific character in NSString/UILabel within the superview
- Xcode Check If Point Is in Transformed UIView
- no visible @interface for 'UITouch' declares the selector 'locationInView'
- Split the CGPoint numbers in two CGFloat
- Bad access code when allocating a class containing a CGPoint and initializing it
- View is not set back to original position
- If statement: CGPoint returns strange value
- More Precise CGPoint for UILongPressGestureRecognizer
- Getting a CGPoint on a UIBezierpath
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
A CGPoint is a logical construct, not a graphical. With that said, the following will produce a point rotated around another (called point). This may not apply directly, but should give you some direction. The key is CGAffineTransform.