Questions tagged [bounds]

In user interfaces and graphics, bounds refer to the size and location of a window or view.

In user interfaces and graphics, bounds refers to the size and location of a window or view. In 2D graphics, this is broken down into four parts. Combinations often used include:

  • x-location, y-location, width, and height.
  • x-location, y-location, right, bottom.

Likewise, in 3D graphics, bounds are often broken into 6 components:

  • x, y, z, width, height, depth
769 questions
327
votes
6 answers

UIView frame, bounds and center

I would like to know how to use these properties in the right manner. As I understand, frame can be used from the container of the view I am creating. It sets the view position relative to the container view. It also sets the size of that view. Also…
Lorenzo B
  • 33,216
  • 24
  • 116
  • 190
292
votes
8 answers

When is layoutSubviews called?

I have a custom view that's not getting layoutSubview messages during animation. I have a view that fills the screen. It has a custom subview at the bottom of the screen that correctly resizes in Interface Builder if I change the height of the nav…
Steve Weller
  • 4,599
  • 4
  • 23
  • 30
196
votes
3 answers

UIView's frame, bounds, center, origin, when to use what?

UIView has the properties frame, bounds, center, and origin, and they all seem to be interrelated. Most of the time, I deal with frame when setting the position and size of a UIView. I understand that frame is using global coordinate system and…
Boon
  • 40,656
  • 60
  • 209
  • 315
129
votes
2 answers

How does clipsToBounds work?

I would like to know how to use the UIView property clipsToBounds. The official documentation says the following: clipsToBounds property A Boolean value that determines whether subviews are confined to the bounds of the view. Discussion Setting…
Toshi
  • 6,012
  • 8
  • 35
  • 58
83
votes
6 answers

How to iterate over an array and remove elements in JavaScript

I have an array of elements and need to remove certain ones from it. The problem is that JavaScript doesn't seem to have a for each loop and if I use a for loop I run into problems with it basically trying to check elements beyond the bounds of the…
Captain Stack
  • 3,572
  • 5
  • 31
  • 56
54
votes
6 answers

Why can't a Generic Type Parameter have a lower bound in Java?

I gather that you cannot bind a Java generics type parameter to a lower bound (i.e. using the super keyword). I was reading what the Angelika Langer Generics FAQ had to say on the subject. They say it basically comes down to a lower bound being…
Mark Peters
  • 80,126
  • 17
  • 159
  • 190
52
votes
6 answers

Getting the correct bounds of UIViewController's view

I have an iPad-application. In landscape orientation the UIViewController's view actual width = 1024px and height = 768 - 20 (statusBar) - 44 (navigationBar) = 704px. So I wanna get this [1024 x 704] size and I'm using self.view.bounds for it. It…
demon9733
  • 1,054
  • 3
  • 13
  • 35
47
votes
4 answers

Is it well-defined to use a pointer pointing to one-past-malloc?

In C, it is perfectly well to make a pointer that points to one past the last element of an array and use it in pointer arithmetics, as long as you don't dereference it: int a[5], *p = a+5, diff = p-a; // Well-defined However, these are UBs: p =…
iBug
  • 35,554
  • 7
  • 89
  • 134
39
votes
4 answers

When would a UIView's bounds.origin not be (0, 0)?

When would an UIView's bounds.origin not be (0, 0)? This paragraph was helpful to me: IMPORTANT!! Bounds X and Y, the origin, are for moving inside the View. For eample X+5, moving 5pix to the left of the frame's origin meaning draw all…
BergP
  • 3,453
  • 4
  • 33
  • 58
39
votes
10 answers

Getting the bounds of an MKMapView

In order to setup a query to an external server I want to get the bounds of the current Map View in an iPhone app I'm building. UIView should respond to bounds but it seems MKMapView doesn't. After setting a region and zooming in the map I try to…
deadroxy
  • 1,699
  • 2
  • 17
  • 22
27
votes
2 answers

Android Google Maps get Boundary Co-ordinates

I am using Google Maps v2 in my application. When the user pans or zooms on the screen I would like to get the area of the map based on which I want to fetch the POI only in the screen view part. I went through the documentation but could not find…
Harsha M V
  • 54,075
  • 125
  • 354
  • 529
26
votes
3 answers

Error : Index was outside the bounds of the array.

I'm aware of what the issue is stating but I am confused to how my program is outputting a value that's outside of the array.. I have an array of ints which is 0 - 8 which means it can hold 9 ints, correct? I have an int which is checked to make…
Zain
  • 1,246
  • 4
  • 15
  • 26
19
votes
4 answers

Determine the bounding rect of a WPF element relative to some parent

I consider this a pretty simple request, but I can't seem to find a conclusive answer in my searches. How can I determine the bounds of a particular visual element in my window, relative to some other parent element? I've tried using…
devios1
  • 36,899
  • 45
  • 162
  • 260
19
votes
7 answers

How to get bounds of a google static map?

How to get bounds in degrees of google static map which has been returned, for example, for following request http://maps.googleapis.com/maps/api/staticmap?center=0.0,0.0&zoom=10&size=640x640&sensor=false As I know, full Earth map is 256x256 image.…
17
votes
5 answers

Animate a CALayer's bounds w/redraws

I am wondering how one might animate a CALayer's bounds so, on each bounds change, the layer calls drawInContext:. I've tried the 2 following methods on my CALayer subclass: Setting needsDisplayOnBoundsChange to YES Returning YES for the +…
Sam
  • 2,707
  • 20
  • 25
1
2 3
51 52