I am drawing text in the view with CoreText. To learn this I used a tutorial, but suddenly it uses self.bounds.size.height
, in a part where it flips the coordinate system. When I was duplicating the code in Xcode it gave an error because 'bounds' was not a structure or union. Why is this a error and can anyone give a small but detailed explanation of why it uses bounds
Thanks on forehand,
Nicholas
Asked
Active
Viewed 516 times
2

Filip Radelic
- 26,607
- 8
- 71
- 97

user744149
- 35
- 4
-
Where do you call this `self.bounds.size.height` code from? – Filip Radelic Aug 28 '11 at 22:16
-
I got the code from this tutorial: http://www.cocoanetics.com/2011/01/befriending-core-text/ – user744149 Sep 01 '11 at 09:18
-
No, I mean where did you put that code? If it's inside UIView subclass, it should be ok, but I'm guessing it's inside UIViewController subclass. In that case it should be `self.view.bounds.size.height` – Filip Radelic Sep 01 '11 at 11:05
-
Yes I did, but now you've mentioned, it makes a lot more sense putting it in a subclass of UIView, thanks! – user744149 Sep 02 '11 at 09:40
-
Ok, I posted my comment as an answer, so please accept it if it helped :) – Filip Radelic Sep 02 '11 at 09:48
1 Answers
0
If you placed that code inside a UIViewController subclass, it should be: self.view.bounds.size.height
. Or put it in a UIView subclass like in the tutorial you followed.

Filip Radelic
- 26,607
- 8
- 71
- 97