Questions tagged [subview]

subview is an abstract representation of a nested hierarchy of views in a MVC framework

A subview can be defined either explicitly as a separate class, or implicitly via object composition, depending on the framework.

References

1264 questions
36
votes
4 answers

Check if a subview is in a view using Swift

How do I test if a subview has already been added to a parent view? If it hasn't been added, I want to add it. Otherwise, I want to remove it.
Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393
33
votes
2 answers

how to get access subview of UIView?

according to this code if i want to access imageView1 and imageView2 how can i access to it? please show me some example example cell.accessoryView.subviews ? UIImageView *imageView1 = [[[UIImageView alloc] init] autorelease]; UIImageView…
RAGOpoR
  • 8,118
  • 19
  • 64
  • 97
31
votes
4 answers

Next/Done button using Swift with textFieldShouldReturn

I have a MainView that adds a subview (signUpWindow) when a sign up button is pressed. In my signUpWindow subview (SignUpWindowView.swift), I set up each field with a function, as an example: func confirmPasswordText() { …
Amy Plant
  • 656
  • 1
  • 7
  • 16
28
votes
1 answer

Autolayout and subviews

I am using the iAd suite with storyboards from Apple, as per this link... Apple iAd Storyboard documentation It all works fine until I turn autolayout on. It builds fine but crashes on running. The output I get is: 2013-08-24 12:06:36.138…
Kevin Tarr
  • 387
  • 3
  • 9
27
votes
3 answers

How to remove subviews in Objective-C?

I have added UIButton and UITextView as subviews to my view programmatically. notesDescriptionView = [[UIView alloc]initWithFrame:CGRectMake(0,0,320,460)]; notesDescriptionView.backgroundColor = [UIColor redColor]; [self.view…
mac
  • 4,760
  • 7
  • 31
  • 33
26
votes
3 answers

Performance of UIView: removeFromSuperview VS hide

This question is really basic. What is the performance difference between removing a UIView from the view hierarchy and hiding a UIView? I have read that Views that are not needed should be removed from the view hierarchy. I currently have the…
bas
  • 465
  • 5
  • 13
25
votes
1 answer

Opposite of bringSubviewToFront?

As well as wanting a view to be on top of everything, you might want a view to be below everything, but there is no bringSubviewToBack:. Why not and how do I bring a subview to back?
Erik B
  • 40,889
  • 25
  • 119
  • 135
22
votes
3 answers

UISegmentedControl Best Practice

I'm trying to work out the "best" way to use a UISegmentedControl for an iPhone application. I've read a few posts here on stackoverflow and seen a few people's ideas, but I can't quite sort out the best way to do this. The posts I'm referring to…
Neal L
  • 4,329
  • 8
  • 34
  • 39
21
votes
3 answers

How to remove specific subview?

I've added subview (ViewController) to my ViewController: Location *location = [[Location alloc] initWithNibName:@"Location" bundle:[NSBundle mainBundle]]; [self.subView addSubview:location.view]; How can I latter remove this subview? I know that…
iWizard
  • 6,816
  • 19
  • 67
  • 103
19
votes
4 answers

UIView. How Do I Find the Root SuperView Fast?

I have a random child view in a view hierarchy. What is the best/fastest/cleverest way to get to the root superview? Cheers, Doug
dugla
  • 12,774
  • 26
  • 88
  • 136
19
votes
3 answers

Adding subview to MKMapView that's above the map but below the annotation views?

For an app I'm building, I have a custom "old map" effect PNG that I'd like to overlay on the MKMapView view. Unfortunately, neither way I've tried to do this is exactly right: Add a subview to the MKMapView (issue: the UIImageView for the PNG gets…
Zeppomedio
  • 5,911
  • 3
  • 18
  • 18
19
votes
4 answers

How can I addSubview to UIButton in Interface Builder

Like I said, I add a UIButton in Interface Builder, I want add a UILabel、UIImageView as the button's subviews, but I can't add any object on it in IB. IS anybody know how to do this? Thank you very much. I can use code to achieve that, but I want…
tinln
  • 253
  • 1
  • 2
  • 6
18
votes
1 answer

send subview to the back

I know of a function that brings a view to the front. [self.view bringSubviewToFront:myView]; I am wondering if there is a function that sends a subview to the back.
SirRupertIII
  • 12,324
  • 20
  • 72
  • 121
17
votes
2 answers

Scrollview with embedded tableview

I'm building an iOS app in swift with Xcode 6. I'm trying to embed a view controller with a table view in a scrollview. When the user drags in the table view, it is suppose to move the table, not the the scrollview that it is embedded in. I've made…
Wiingaard
  • 4,150
  • 4
  • 35
  • 67
16
votes
3 answers

Manually fade in a newly added subview?

I want a view to fade in when being added to the stack via [self.view addSubview:someSecondaryViewController.view]; How do I animate this call so that the view fades in (and out)?
Moshe
  • 57,511
  • 78
  • 272
  • 425
1
2
3
84 85