Questions tagged [uiview-hierarchy]
110 questions
102
votes
8 answers
Capturing touches on a subview outside the frame of its superview using hitTest:withEvent:
My problem: I have a superview EditView that takes up basically the entire application frame, and a subview MenuView which takes up only the bottom ~20%, and then MenuView contains its own subview ButtonView which actually resides outside of…

toblerpwn
- 5,415
- 8
- 38
- 46
94
votes
22 answers
How to list out all the subviews in a uiviewcontroller in iOS?
I want to list out all the subviews in a UIViewController. I tried self.view.subviews, but not all of the subviews are listed out, for instance, the subviews in the UITableViewCell are not found. Any idea?

user403015
- 7,209
- 19
- 66
- 100
83
votes
8 answers
Centering subview's X in autolayout throws "not prepared for the constraint"
I have a custom UIView subclass which is being initialized via a nib.
In -awakeFromNib, I'm creating a subview and attempting to center it in its superview.
[self setInteralView: [[UIView alloc] init]];
[[self internalView] addConstraint:…

Patrick Perini
- 22,555
- 12
- 59
- 88
39
votes
4 answers
iOS: Warning "attempt to present ViewController whose view is not in the window hierarchy"
I am getting following warning when I try to present a ActivityController on navigation controller,
Attempt to present on whose view is not in the window hierarchy!
I have…

iOSNoob
- 1,420
- 2
- 16
- 30
39
votes
8 answers
recursiveDescription method in Swift?
Is there a way to use [self.view recursiveDescription] in Swift? I am trying to use this method but I am getting the following error:
'UIView' does not have a member named 'recursiveDescription'
Any suggestions?

Vik Singh
- 1,563
- 2
- 19
- 36
24
votes
5 answers
TouchUpInside on UIView with children
I may be missing something here, but...
I have a UIView with a few children (a couple of UILabel's and UIImageView). I need to catch an event when the user clicks (taps) anywhere within the parent UIView - visible part of the UIView or any of its…

Aleks G
- 56,435
- 29
- 168
- 265
19
votes
4 answers
How to addSubview to the bottom of view hierarchy
I want to add mapView, which I'm adding programatically, to the bottom of hierarchy view, as I already draw some of the elements beforehand, in the storyboard.
So, after i call method:
[self.view addSubview:self.map];
How do I put it on the bottom…

SteBra
- 4,188
- 6
- 37
- 68
15
votes
3 answers
How to add image with parallax effect above UITableView header and keep header sticky?
Here is an image that explains everything I want to do:
My question is, how would I make my view structure. The header of the table view should be fixed at top of the table. But what about the top most image that is above the table view header.…

NSPratik
- 4,714
- 7
- 51
- 81
13
votes
3 answers
What is _UILayoutGuide?
I need to know about _UILayoutGuide, like what it is, what it does and why it present in the hierarchy of UIView as a subview with almost always frame = (0,0,0,0).

Suryakant Sharma
- 3,852
- 1
- 25
- 47
10
votes
1 answer
Embedding a UICollectionView in a UIScrollView works almost perfectly
Background
I embedded a UICollectionView inside of a UIScrollView and it works almost perfectly.
Goal
The scrollable elements should pass off the scroll seamlessly once they've reached the end of their contentViews. When I swipe down on the…

Emin Israfil iOS
- 1,801
- 1
- 17
- 26
9
votes
3 answers
How to programmatically set view to the front/back?
I'm working on an application that uses UIViews as backgrounds to text. I've put the views behind the text in the storyboard but for some reason some still seem to be in front of the text. Is there a way to send these view to the back…

Ross Sullivan
- 396
- 1
- 3
- 13
9
votes
1 answer
Setting up auto layout constraints for programmatic view hierarchy?
I'm creating my view hierarchy programmatically like this:
UIWindow* window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
UIViewController1* viewController1 = [[UIViewController1 alloc] init];
UIViewController2* viewController2…

ABeanSits
- 1,725
- 1
- 17
- 34
8
votes
2 answers
What type of contents UIViewContentMode mode refers to?
According to the official doc on UIView about the contentMode property:
The content mode specifies how the cached bitmap of the view’s layer is adjusted when the view’s bounds change
What's defined the content in this definition? Is it a sub view…

tiguero
- 11,477
- 5
- 43
- 61
7
votes
2 answers
Is It Possible To Customise CNContactPickerViewController?
I'm opening a CNContactPickerViewController for use in an application, but I want to alter the way it presents to suit my apps needs, preferably without rolling my own and doing a lot of re-inventing of the wheel. This is how I am opening it using…

Plasma
- 2,622
- 2
- 20
- 35
7
votes
1 answer
Show UIView with buttons over keyboard, like in Skype,Viber messengers (Swift, iOS)
I want to create attachments view, that places under input accessory view, over keyboard, like in Skype App or Viber:
I already asked such question here, but suggested solution for this question was not so elegant, because when i drag my scroll…

pavel_s
- 465
- 1
- 7
- 27