Skip to content

Tarik Billa

  • Web Development
    • html
    • vue.js
    • laravel
    • css
    • javascript
    • jquery
    • node.js
    • php
    • asp.net
  • Programming
    • python
    • java
    • c
    • c++
    • c#
  • git
  • android

cgrectmake

How do I get the current x and y position so that I can use GCRectMake?

December 10, 2023 by Tarik
Categories ios Tags cgrectmake, ios, swift Leave a comment

iOS frame change one property (eg width)

May 24, 2023 by Tarik

To answer your original question: yes, it’s possible to change just one member of a CGRect structure. This code throws no errors: myRect.size.width = 50; What is not possible, however, is to change a single member of a CGRect that is itself a property of another object. In that very common case, you would have … Read more

Categories ios Tags cgrect, cgrectmake, ios, objective-c Leave a comment

How do I create a CGRect from a CGPoint and CGSize?

April 22, 2023 by Tarik

Two different options for Objective-C: CGRect aRect = CGRectMake(aPoint.x, aPoint.y, aSize.width, aSize.height); CGRect aRect = { aPoint, aSize }; Swift 3: let aRect = CGRect(origin: aPoint, size: aSize)

Categories ios Tags cgpoint, cgrectmake, ios, objective-c, quartz-graphics Leave a comment

Update CGRectMake to CGRect in Swift 3 Automatically

April 19, 2023 by Tarik

The simplest solution is probably just to redefine the functions Apple took away. Example: func CGRectMake(_ x: CGFloat, _ y: CGFloat, _ width: CGFloat, _ height: CGFloat) -> CGRect { return CGRect(x: x, y: y, width: width, height: height) } Put that in your module and all calls to CGRectMake will work again.

Categories ios Tags cgrectmake, ios, swift, swift3 Leave a comment

How to initialize properties that depend on each other

February 9, 2023 by Tarik

@MartinR has pointed out the major issue here: var corX = 0 var corY = 0 var panzer = UIImageView(frame: CGRectMake(corX, corY, 30, 40)) The problem is that a Swift default initializer cannot refer to the value of another property, because at the time of initialization, the property doesn’t exist yet (because the instance itself … Read more

Categories xcode Tags cgrectmake, frame, swift, xcode Leave a comment

Tarik Billa

Software Engineer
tarikbilla@gmail.com
+8801884414000
  • Reuse a hash in YAMLApril 17, 2024
  • Dockerfile: how to redirect the output of a RUN command to a variable?April 16, 2024
  • How to cd to a directory with spaces in the directory name?April 16, 2024
  • Maximum MIME type length when storing the type in a databaseApril 16, 2024
  • What is the difference between Unit, Integration, Regression and Acceptance Testing?April 16, 2024
© 2026 Tarik Billa