Views and Gestures - Views

13 important questions on Views and Gestures - Views

What does a view represent?

A rectangular space on screen, a coordinates space

How many superviews does a view have?

A view has 1 superview

Does the subview order matter (in subviews array)?

Yes, those later in the array are on top.
  • Higher grades + faster learning
  • Never study anything twice
  • 100% sure, 100% understanding
Discover Study Smart

Can you construct a view in code?

Yes: -(void) addSubview: (UIView *)aView; (send to its soon to be superview)

How do we remove a view in code?

-(void) removeFromSuperview; (send to the view who's going to be removed)

Does the controller of a MVC have a property for it's view?

Yes: @property(strong, nonatomic) UIView *view;

How can you know the amount of pixels per point?

A property "contentScaleFactor" returns the pixels(s) per point.
@property CGFloat contentScaleFactor;

Whats the difference between the property "bounds" and "frame"?

Bounds is used by the view and frame by its superview

How do you create a UIView in code?

Just use alloc and initWithFrame: (UIView's designated initializer)

When your view needs to be redrawn, do you call drawrect: or setNeedsDisplay ?

- (void) setNeedsDisplay: (NEVER call drawrect, the system should call this, not you)

When you want to draw with transparency what do you need to do?

Set the property "opaque" to NO

What happens to a view if you set the property "hidden" to YES?

Its will be invisible, but still there (in the subviews array)

When do your bounds change?

When the device is rotated

The question on the page originate from the summary of the following study material:

  • A unique study and practice tool
  • Never study anything twice again
  • Get the grades you hope for
  • 100% sure, 100% understanding
Remember faster, study better. Scientifically proven.
Trustpilot Logo