Questions tagged [superview]
137 questions
4
votes
2 answers
self.view / super.view
what's the difference between
[self.view addSubview:view1];
and
[super.view addSubview:view1];
Thank You!!
Franhu

user451295
- 53
- 1
- 5
4
votes
1 answer
(iphone) how to set view.center when detaching a view from scroll view and adding it to another view?
I'd like to move a view from a scrollview to a uiview.
I'm having trouble changing it's center(or frame) so that it remains in the same position in screen (but in a different view, possibly the superview of scrollview).
How should I convert the…

eugene
- 39,839
- 68
- 255
- 489
4
votes
2 answers
Swift3 Call function in parent out of function in child view
I have a child UIView class instantiated in an UIViewController, the UIViewController has a function called sigIn(){}. I need to call this function from within UIView.
I tried somehow using the self.superview and casting it into a UIViewController…

Mercury
- 594
- 1
- 12
- 28
4
votes
1 answer
Changing superview breaks UIPanGestureRecognizer
I'm trying to implement a UIView that can be dragged out of its superview.
I tried adding a UIPanGestureRecognizer to the view I want to be able to drag. It seems, however, that removing the UIView from its superview and adding it to another view,…

Rich
- 7,348
- 4
- 34
- 54
3
votes
2 answers
NSView - get superview hierarchy
Is there a simple way to walk back up the NSView hierarchy (superview of superview of superview of nsview) to the main window or a point in between?
Thanks

PruitIgoe
- 6,166
- 16
- 70
- 137
3
votes
5 answers
NSView remove some subviews from superview
I have a ad layout program which builds pages (NSView class Page) and on each page places margins and gutters (more NSViews) and then ads (NSView class Ad). The app auto places ads from a database source, looking for the proper space to fill on each…

PruitIgoe
- 6,166
- 16
- 70
- 137
3
votes
2 answers
Swift iOS -How to get frame of button inside cell's superView
I have collectionView inside a view controller. Inside the collectionView cell I have a button. Since there will be several cells each button will have a different location inside the vc. When a button is tapped, how can I get the frame of the…

Lance Samaria
- 17,576
- 18
- 108
- 256
3
votes
2 answers
Hiding a superview without hiding its subviews
generally I know there are workarounds for this, but is there any simple way in the iOS SDK to hide a superview without hiding its subviews?
I have a parent view that is a background to a few other views. I would like to hide the parent, either…

mag725
- 695
- 2
- 9
- 22
2
votes
1 answer
NSView: drag subview from superview to another NSView
I have an app that lays out pages for a magazine. The app lays out pages (NSViews of a class called Page) of a magazine on a NSView called MasterPage (which itself is the contentView of an NSScrollView). Think of a grid of pages in a scroll view.…

PruitIgoe
- 6,166
- 16
- 70
- 137
2
votes
1 answer
Tell Superview to ignore touch events?
I am adding a subview to my superview and I need to know how to tell the superview to ignore touch events so that the only view receiving touch events, is the subview.
How would this be done?
Thanks!

SimplyKiwi
- 12,376
- 22
- 105
- 191
2
votes
3 answers
Is UIView superview property weak or strong?
The UIView header states that superview property is strong
open var superview: UIView? { get }
But it behaves just like a weak property, i.e. if I create view1 and view2 and then call view1.addSubview(view2), and then save a strong ref to view2…

timaktimak
- 1,380
- 1
- 12
- 21
2
votes
2 answers
How to Resize View so That Its Subviews Get Resized Too
My window adds a subview (my root ViewController's view).
Such subview is superview of several other subviews.
I have just finished an app, and now I want to add an ad.
Here's some code:
[window…
user444854
2
votes
3 answers
add overlay view over all other views
how do you add an overlay view that goes over everything. eg over a tab bar controller, and a navigation controller?
thanks

padatronic
- 98
- 2
- 5
2
votes
1 answer
Buttons not returned by subviews in Compact:Regular
I am writing an application for iOS. I have 3 buttons (of a custom UIButton subclass) in my view, each are added graphically through IB. I was running into a bug that I realized was coming from the fact that only one of the buttons' superview is…

ericmarkmartin
- 717
- 1
- 8
- 19
2
votes
0 answers
Autolayout Crash while setting view position to superview
I am getting crash when I am setting the view position
2014-10-06 15:25:01.896 sample[21174:60b] The view hierarchy is not prepared for the constraint:
When added to a view, the constraint's items must be descendants of that view (or the view…

Sanoj Kashyap
- 5,020
- 4
- 49
- 75