Questions tagged [cgrect]

CGRect is a structure from the ApplicationServices framework used with Apple's OSX and iOS operating systems. This structure is used to represent the origin and size of a rectangle.

CGRect is a structure that contains the location and dimensions of a rectangle.

Fields

  • origin: A point that specifies the coordinates of the rectangle’s origin.
  • size: A size that specifies the height and width of the rectangle.
716 questions
-2
votes
2 answers

Sum of Two CGRect

how to get sum of two CGRect CGRect requiredFirst = [firstName boundingRectWithSize:constrainedSize options:NSStringDrawingUsesLineFragmentOrigin context:nil]; CGRect requiredLast = [lastName boundingRectWithSize:constrainedSize…
KkMIW
  • 1,092
  • 1
  • 17
  • 27
-2
votes
2 answers

How to change UICollectionView frame on button touch

I am trying following code but nothing works : CGRect frame = collectionview.frame; collectionview.frame = CGRectMake (frame.origin.x, frame.origin.y+100, frame.size, frame.size-100); AutoLayout is set to true for the project.
-3
votes
1 answer

Type of expression is ambiguous without more context error message when I try to blend two images

I'm trying to blend two same size images using code below but "filteredImage.image?.draw(in: areaSize, blendMode: .normal, alpha: opa)" this code will show error message says "Type of expression is ambiguous without more context".. What is wrong? …
JessJ
  • 57
  • 9
-3
votes
2 answers

Expression too complex swift Xcode error

Can't get Xcode to compile, getting this error: Expression was too complex to be solved in reasonable time; consider breaking up the expression into distinct sub-expressions self.locationButton.frame = CGRect(x: self.view.bounds.size.width/2 +…
-3
votes
1 answer

Aspect fit in cgsize programmatically in swift

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.adjustsFontSizeToFitWidth = true let rectShape =…
booak55
  • 111
  • 2
  • 11
-3
votes
1 answer

convert Swift 2.3 to Swift 4

I am new in Swift 4 and I want to resolve the Swift version 2.0 Project with Uitextview error here is error in Swift 4 let textView = UITextView(frame: CGRectInset(view.bounds, 10, 10)) I will change with 'CGRectInset' has been replaced by…
user2296278
  • 528
  • 1
  • 4
  • 17
-3
votes
1 answer

Xcode Swift error following ugrade to swift 3.0 - CGRectMake

I am attempting to get an image to display/align correctly to the left of some text. Prior to upgrading to Swift 3.0, I obtain the task using the following: textLabel?.frame = CGRectMake(56, textLabel!.frame.origin.y, textLabel!.frame.width,…
user1724708
  • 1,409
  • 7
  • 31
  • 53
-3
votes
1 answer

How to rotate 90 clockwise (swift3)

This 2 lines of code produce a image that is 90 counter clockwise from the way i took the image. Any ideas how I can use code to rotate the image 90 degrees clockwise? let l = photoDispaly.image l?.draw(in: CGRect(x: 10, y: 240.5, width:…
user7459574
-4
votes
1 answer

need help about resize image swift 2

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 import Alamofire class FeedViewController:…
-4
votes
1 answer

CGRectContainsPoint fails in iOS

I am using CGRectContainsPoint to find whether a point is inside a rect but it always returns false. If I am wrong please correct me and help me understand whether the point is inside the CGRect. Here is my code: BOOL isObjectInside = false; …
user3115014
  • 667
  • 1
  • 8
  • 23
-5
votes
1 answer

Objective-c random point which lies in given cgrect

my requirement is generating a random point in a given area, i.e i have an CGRect of some space and i need to generate a rendom point in this rect .. how can i proceed in this scenario ??
Dinesh619
  • 61
  • 2
1 2 3
47
48